fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner console = new Scanner(System.in);
  13.  
  14. while (console.hasNextLine()) {
  15. String n = console.nextLine();
  16. Integer x = Integer.parseInt(n.substring(n.length()-1));
  17. System.out.println(x);
  18. Integer y = Integer.parseInt(n.substring(0, 1));
  19. System.out.println(y);
  20. String out;
  21. if (y % 2 == 0 && x % 2 == 0)
  22. {
  23. out = "$"+n.substring(1, n.length()-1)+"$";
  24. }
  25. else if (y % 2 > 0 && x % 2 > 0) {
  26. out = "X" +n.substring(1, n.length()-1) + "X";
  27. }
  28. else if (x == 0);
  29. {
  30. out = n.substring(0, n.length()-1)+ "#";
  31. }
  32. System.out.println(out);
  33. }
  34. }
  35. }
Success #stdin #stdout 0.11s 2184192KB
stdin
34567
stdout
7
3
3456#