Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace string_3_c_sharp
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Введите строку");
- string originalLine = Console.ReadLine();
- if (String.IsNullOrEmpty(originalLine))
- {
- Console.WriteLine("Введенная последовательность пуста!");
- Console.ReadKey();
- return;
- }
- char[] vowels = new[] { 'а', 'е', 'и', 'о', 'у', 'я', 'ю' };
- string[] separate_line = originalLine.Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
- string lastWord = separate_line[separate_line.Length - 1];
- for (int i = 0; i < separate_line.Length; i++ )
- {
- bool isAlternating = false;
- if (separate_line[i] != lastWord)
- {
- isAlternating = true;
- for (int j = 0; j < separate_line[i].Length - 1; j++)
- {
- if (vowels.Contains(separate_line[i][j]) && vowels.Contains(separate_line[i][j+1]))
- isAlternating = false;
- }
- }
- if (isAlternating)
- Console.WriteLine(separate_line[i]);
- }
- Console.WriteLine(lastWord);
- Console.WriteLine("Press <Enter> to exit.");
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement