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