package xiaosuanfa;
public class test {
public static void main(String[] a) {
int i = test();
}
public static int test() {
String str = "abcddc";
for (int i = 0; i < str.length(); i++) {
String s = str.substring(i, i + 1);
int firstIndex = str.indexOf(s);
String s2 = str.substring(i + 1);
if (s2.indexOf(s) >= 0) {
System.out.println(s);
System.out.println(s.indexOf(str) + i + 1);
return s.indexOf(str) + i + 1;
}
}
return -1;
}
}