angelllo

letter

Mar 27th, 2020
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp8
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string letter = Console.ReadLine();
  10. int counterC = 0;
  11. int counterO = 0;
  12. int counterN = 0;
  13. string word = string.Empty;
  14. string word1 = string.Empty;
  15.  
  16.  
  17. while (letter != "End")
  18. {
  19. char symbol = char.Parse(letter);
  20.  
  21. if (symbol >= 'a' && symbol <= 'z' || symbol >= 'A' && symbol <= 'Z')
  22. {
  23. if (symbol == 'c' && counterC == 0)
  24. {
  25. counterC++;
  26. }
  27. else if (symbol == 'o' && counterO == 0)
  28. {
  29. counterO++;
  30. }
  31. else if (symbol == 'n' && counterN == 0)
  32. {
  33. counterN++;
  34. }
  35. else
  36. {
  37. word += symbol;
  38. }
  39.  
  40. if (counterC + counterO + counterN == 3)
  41. {
  42. word1 += word;
  43. word1 += ' ';
  44. word = string.Empty;
  45. counterC = 0;
  46. counterO = 0;
  47. counterN = 0;
  48. }
  49.  
  50. }
  51. letter = Console.ReadLine();
  52. }
  53. Console.WriteLine(word1);
  54. }
  55.  
  56. }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment