프로그래밍 언어 활용난도 중상
17번 · 주관식 · 5점
다음 Java 프로그램의 실행 결과를 쓰시오.
public class Main {
static String uniqueReverse(String value, int index) {
if (index < 0) return "";
char current = value.charAt(index);
String rest = uniqueReverse(value, index - 1);
return rest.indexOf(current) >= 0 ? rest : current + rest;
}
public static void main(String[] args) {
String value = "abacad";
System.out.print(uniqueReverse(value, value.length() - 1));
}
}