Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace StreamOfLetters
- {
- class Program
- {
- static void Main(string[] args)
- {
- string word = "";
- string total = "";
- int c = 0;
- int o = 0;
- int n = 0;
- while (true)
- {
- string letter = Console.ReadLine();
- if (letter == "End")
- {
- break;
- }
- char letters = char.Parse(letter);
- if (letters >= 'A' && letters <= 'Z' || letters >= 'a' && letters <= 'z')
- {
- if (letters == 'c' && c == 0)
- {
- c += 1;
- }
- else if (letters == 'o' && o == 0)
- {
- o += 1;
- }
- else if (letters == 'n' && n == 0)
- {
- n += 1;
- }
- else
- {
- word += letters;
- }
- if (c == 1 && o == 1 && n == 1)
- {
- c -= 1;
- o -= 1;
- n -= 1;
- total += " " + word;
- word = "";
- }
- }
- }
- Console.WriteLine(total);
- }
- }
- }
Add Comment
Please, Sign In to add comment