Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- public static void Main()
- {
- Console.Write("Enter n: ");
- int n = int.Parse(Console.ReadLine());
- string[] cities = new string[n];
- for (int i = 0; i < n; i++)
- {
- Console.Write("Enter city: ");
- cities[i] = Console.ReadLine();
- }
- bool isRight = true;
- for (int i = 0; i < n; i++)
- {
- isRight = false;
- string[] args = cities[i].Trim().Split(' ');
- if (args.Length == 2)
- {
- isRight = true;
- }
- if (args.Length > 2)
- {
- int counter = 0;
- for (int j = 0; j < args.Length; j++)
- {
- if (args[j] != "")
- {
- counter++;
- }
- }
- if (counter == 2)
- {
- isRight = true;
- }
- }
- if (isRight)
- {
- Console.WriteLine(cities[i]);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment