[Java] 특정 문자 뒤집기 - String(문자열)
·
💡 Algorithm/인프런
Problem 💻영어 알파벳과 특수문자로 구성된 문자열이 주어지면 영어 알파벳만 뒤집고,특수문자는 자기 자리에 그대로 있는 문자열을 만들어 출력하는 프로그램을 작성하세요. Solution 💡public class INF0105 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); INF0105 inf = new INF0105(); System.out.println(inf.solution(s)); } public String solution(String s) { String answer = ""; ..
[JAVA] 단어 뒤집기 - String(문자열)
·
💡 Algorithm/인프런
public class INF0104T2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); String[] arr = new String[n]; for (int i = 0; i < n; i++) { arr[i] = sc.next(); } INF0104T2 inf = new INF0104T2(); for(String s : inf.solution(n, arr)) { System.out.println(s); } } public ArrayList solution(int n, String[] arr) { ArrayList answer = new ArrayList(); //직접 뒤집..