fork(1) 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. String s = "Par programming is fun!";
  13. s = s.toLowerCase();
  14.  
  15.  
  16. int[] contagens = new int[256];
  17. for (int i = 0; i < s.length(); ++i)
  18. contagens[s.charAt(i)]++;
  19.  
  20. for (int i = 0; i < 256; ++i){
  21. if(contagens[i] > 1){
  22. System.out.println("Number of occurences of " + (char)i + " is " + contagens[i]);
  23. }
  24. }
  25. }
  26. }
Success #stdin #stdout 0.1s 27740KB
stdin
Standard input is empty
stdout
Number of occurences of   is 3
Number of occurences of a is 2
Number of occurences of g is 2
Number of occurences of i is 2
Number of occurences of m is 2
Number of occurences of n is 2
Number of occurences of p is 2
Number of occurences of r is 3