fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4.  
  5. /* Name of the class has to be "Main" only if the class is public. */
  6. class Ideone
  7. {
  8.  
  9. String number;
  10. char [] dashes;
  11. int counter=0; //acumula valores
  12.  
  13. public Ideone (String number)
  14. {
  15. this.number = number;
  16. }
  17.  
  18.  
  19. public void loop(){
  20. for(int i =0; i<number.length(); i++){
  21. char a = number.charAt(i);
  22. if(a == '0' || a == '6' || a=='9'){
  23. counter = counter + 6;
  24. } else if(a == '2' || a == '3' || a=='5'){
  25. counter = counter + 5;
  26. } else if(a == '1'){
  27. counter = counter + 2;
  28. } else if(a == '4'){
  29. counter = counter + 4;
  30. } else if(a == '7'){
  31. counter = counter + 3;
  32. } else if(a == '8'){
  33. counter = counter + 7;
  34. }
  35.  
  36. }
  37.  
  38.  
  39. System.out.println("The total is: "+ counter);
  40. }
  41.  
  42. public static void main (String[] args) throws java.lang.Exception
  43. {
  44. String numbers = "73254370932875002027963295052175";
  45. Ideone i = new Ideone(numbers);
  46. i.loop();
  47. }
  48.  
  49. https://c...content-available-to-author-only...r.com/tc?module=ProblemDetail&rd=8068&pm=4788
  50.  
  51.  
  52.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:49: error: <identifier> expected
https://community.topcoder.com/tc?module=ProblemDetail&rd=8068&pm=4788
     ^
Main.java:49: error: reached end of file while parsing
https://community.topcoder.com/tc?module=ProblemDetail&rd=8068&pm=4788
      ^
2 errors
stdout
Standard output is empty