Advertisement
Guest User

Untitled

a guest
May 26th, 2016
1,373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 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 CountNumber
  8. {
  9. class CountNumber
  10. {
  11. static void Main(string[] args)
  12. {
  13. List<string> words = Console.ReadLine().Split(new char[] { ' ', ',', ';', ':', '.', '!', '(', ')', '"', '\'', '/', '\\', '[', ']' },
  14. StringSplitOptions.RemoveEmptyEntries).ToList();
  15. List<string> lowerCase = new List<string>();
  16. List<string> mixedCase = new List<string>();
  17. List<string> upperCase = new List<string>();
  18. foreach (var word in words)
  19. {
  20. bool isAllLowerCase = true;
  21. bool isAllUpperrCase = true;
  22. for (int i = 0; i < word.Length; i++)
  23. {
  24. if (char.IsLower(word[i]))
  25. {
  26. isAllUpperrCase = false;
  27. }
  28. else if (char.IsUpper(word[i]))
  29. {
  30. isAllLowerCase = false;
  31. }
  32. else
  33. {
  34. isAllLowerCase = false;
  35. isAllUpperrCase = false;
  36. }
  37.  
  38. }
  39. if (isAllLowerCase)
  40. {
  41. lowerCase.Add(word);
  42. }
  43. else if (isAllUpperrCase)
  44. {
  45. upperCase.Add(word);
  46. }
  47. else
  48. {
  49. mixedCase.Add(word);
  50. }
  51. }
  52. Console.WriteLine("Lower-case: {0}", string.Join(", ", lowerCase));
  53. Console.WriteLine("Mixed-case: {0}", string.Join(", ", mixedCase));
  54. Console.WriteLine("Upper-case: {0}", string.Join(", ", upperCase));
  55. }
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement