Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2013
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _21.DiffrentLettersInString
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var text = "aaaaa bcd eeeff";
  14.  
  15. char[] letters = new char[65536];
  16.  
  17. for (int i = 0; i < text.Length; i++)
  18. {
  19. if (char.IsLetter(text[i]))
  20. {
  21. letters[text[i]]++;
  22. }
  23. }
  24.  
  25. for (int i = 0; i < letters.Length; i++)
  26. {
  27. if (letters[i]>0 && char.IsLetter((char)i))
  28. {
  29. Console.WriteLine("{0} {1}",(char)i,(int)letters[i]);
  30. }
  31. }
  32.  
  33. }
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement