fork download
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4. public static void main(String[] args) {
  5. Scanner entry = new Scanner(System.in);
  6. int inputs = entry.nextInt();
  7. String[] strings = new String[inputs];
  8. for (int i = 0; i < strings.length; i++) {
  9. strings[i] = entry.nextLine();
  10. }
  11. int x = 0;
  12. for (String s : strings) {
  13. x++;
  14. System.out.print("Input #" + x + ": ");
  15. Boolean found = false;
  16. String[] split = s.split("");
  17. String string = "";
  18. for (int i = 0; i < split.length; i++) {
  19. if (string.contains(split[i])) {
  20. System.out.print(split[i] + " found at indexes " + string.indexOf(split[i]) + " and " + i + "\n");
  21. found = true;
  22. break;
  23. } else {
  24. string += split[i];
  25. }
  26. }
  27. if (!found) {
  28. System.out.print("No recurring character found.\n");
  29. }
  30. }
  31. }
  32. }
Success #stdin #stdout 0.1s 2841600KB
stdin
3
IKEUNFUVFV
PXLJOUDJVZGQHLBHGXIW
*l1J?)yn%R[}9~1”=k7]9;0[$
stdout
Input #1:  found at indexes 0 and 0
Input #2: U found at indexes 3 and 6
Input #3: J found at indexes 3 and 7