17. 다음 Java로 구현된 프로그램을 분석하여 그 실행 결과를 쓰시오.
public class Main {
public static String rf(String str, int index, boolean[] seen) {
if(index < 0) return "";
char c = str.charAt(index);
String result = rf(str, index-1, seen);
if(!seen[c]) {
seen[c] = true;
return c + result;
}
return result;
}
public static void main(String[] args) {
String str = "abacabcd";
int length = str.length();
boolean[] seen = new boolean[256];
System.out.print(rf(str, length-1, seen));
}
}
| 정답 확인 | 맞췄어요 O | 틀렸어요 X |