fork download
  1. import java.io.BufferedReader;
  2. import java.io.IOException;
  3. import java.io.InputStreamReader;
  4. import java.util.LinkedList;
  5. import java.util.StringTokenizer;
  6.  
  7. public class FixingTypos {
  8.  
  9. public static void main(String[] args) throws IOException {
  10. StringBuilder s = new StringBuilder();
  11. LinkedList<Character> ll = new LinkedList<Character>();
  12. while (true) {
  13. int n = Integer.parseInt(br.readLine());
  14. if (n == 0)
  15. break;
  16. int max = -1;
  17. String ss = br.readLine().toLowerCase();
  18. for (int i = 0; i < ss.length() - n; i++) {
  19. int j;
  20. ll = new LinkedList<Character>();
  21.  
  22. for (j = i + 1; j < ss.length() && ll.size() <= n; j++) {
  23. if (!(ll.contains(ss.charAt(j))) && ll.size() == n) {
  24. j--;
  25. break;
  26. }
  27. if (!(ll.contains(ss.charAt(j)))) {
  28. ll.add(ss.charAt(j));
  29. }
  30. }
  31. max = Math.max(max, (j - i));
  32. }
  33. s.append(max + "\n");
  34. }
  35. System.out.print(s);
  36. }
  37.  
  38. }
  39.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:7: error: class FixingTypos is public, should be declared in a file named FixingTypos.java
public class FixingTypos {
       ^
1 error
stdout
Standard output is empty