fork download
  1. import java.io.BufferedReader;
  2. import java.io.InputStreamReader;
  3.  
  4. class Main
  5. {
  6. public static void main (String[] args) throws java.lang.Exception
  7. {
  8. BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
  9. String s = bufferedReader.readLine().split(" ")[0];
  10. if (s.substring(s.length() - 2, s.length() - 2 + 2).equals("00"))
  11. {
  12. System.out.print(s.substring(0, s.length() - 2));
  13. }
  14. else
  15. {
  16. for (int i = s.length() - 3; i >= 0; --i)
  17. {
  18. if ((int)s.charAt(i) - 48 + 1 == 10)
  19. {
  20. s = s.substring(0, i) + "0" + s.substring(i + 1);
  21. System.out.println(s);
  22. //s.charAt(i) = '0';
  23. if (i == 0)
  24. {
  25. System.out.print("1");
  26. }
  27. continue;
  28. }
  29. else
  30. {
  31. s = s.substring(0, i) + (char)(s.charAt(i) + 1) + s.substring(i + 1);
  32. //s.charAt(i)++;
  33. break;
  34. }
  35. }
  36. System.out.print(s.substring(0, s.length() - 2));
  37. }
  38. return;
  39. }
  40. }
Success #stdin #stdout 0.04s 2184192KB
stdin
999901
stdout
999001
990001
900001
000001
10000