Advertisement
Guest User

Untitled

a guest
Feb 11th, 2020
1,682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.07 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Stream_Of_Letters
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string command = "";
  10. string word = "";
  11. string sumSicretCommand = "";
  12. char currentLetter = '+';
  13. string newWord = "";
  14.  
  15.  
  16. while (command != "End")
  17. {
  18. command = Console.ReadLine();
  19. if (command != "End")
  20. {
  21. currentLetter = char.Parse(command);
  22. if ((currentLetter >= 65 && currentLetter <= 90) || (currentLetter >= 97 && currentLetter <= 122))
  23. {
  24. if (currentLetter == 'c' && !(sumSicretCommand.Contains("c")))
  25. {
  26. sumSicretCommand += char.ToString(currentLetter);
  27.  
  28. }
  29. else if (currentLetter == 'o' && !(sumSicretCommand.Contains("o")))
  30. {
  31. sumSicretCommand += char.ToString(currentLetter);
  32. }
  33. else if (currentLetter == 'n' && !(sumSicretCommand.Contains("n")))
  34. {
  35. sumSicretCommand += char.ToString(currentLetter);
  36. }
  37. else
  38. {
  39. word += char.ToString(currentLetter);
  40.  
  41. }
  42. if (sumSicretCommand.Contains("c") && sumSicretCommand.Contains("o") && sumSicretCommand.Contains("n"))
  43. {
  44. word += " ";
  45. newWord = word;
  46. sumSicretCommand = "";
  47. }
  48. }
  49. }
  50. else
  51. {
  52. break;
  53. }
  54. }
  55. if (command == "End")
  56. {
  57. Console.WriteLine(newWord);
  58. }
  59. }
  60.  
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement