Advertisement
desislava_topuzakova

04

Feb 12th, 2018
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace p04._Split_by_Word_Casing
  6. {
  7. internal class Program
  8. {
  9. public static void Main(string[] args)
  10. {
  11. List<string> numbers = Console.ReadLine()
  12. .Split(new char[] {',', '.', ';', ':', '!',' ','"','\\', '/','[',']','(',')'})
  13. .ToList();
  14.  
  15. List<string> lowerCase = new List<string>();
  16. List<string> mixedCase = new List<string>();
  17. List<string> upperCase = new List<string>();
  18.  
  19. foreach (var symbol in numbers)
  20. {
  21. bool lower = false;
  22. bool mixed = false;
  23. bool upper = false;
  24.  
  25. foreach (char letter in symbol)
  26. {
  27. if (letter >= 'a' && letter <= 'z')
  28. {
  29. lower=true;
  30. }
  31. else if (letter >= 'A' && letter <= 'Z')
  32. {
  33. upper=true;
  34. }
  35. else
  36. {
  37. mixed=true;
  38. }
  39.  
  40. }
  41.  
  42.  
  43. if (lower && !mixed && !upper)
  44. {
  45. lowerCase.Add(symbol);
  46. }
  47.  
  48. else if (!lower && !mixed && upper)
  49. {
  50. upperCase.Add(symbol);
  51. }
  52. else
  53. {
  54. mixedCase.Add(symbol);
  55. }
  56.  
  57. }
  58.  
  59.  
  60. Console.WriteLine($"Lower-case: {string.Join(", ", lowerCase)}");
  61. Console.WriteLine($"Mixed-case: {string.Join(", ", mixedCase)}");
  62. Console.WriteLine($"Upper-case: {string.Join(", ", upperCase)}");
  63. }
  64. }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement