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 Stringekz
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n;
- Console.WriteLine("Введите кол-во строк");
- n = Convert.ToInt32(Console.ReadLine());
- string[]A = new string[n];
- int[] B = new int[n];
- Console.WriteLine("Введите строки");
- for (int i = 0; i < n; i++)
- A[i] = Console.ReadLine();
- for( int i = 0; i<n; i++)
- {
- string[]At = A[i].Split(' ');
- B[i] = At.Length;
- }
- string tmp;
- for (int i = 0; i < n; i++)
- {
- for (int j = i + 1; j < n; j++)
- {
- if (B[i] > B[j])
- {
- tmp = A[i];
- A[i] = A[j];
- A[j] = tmp;
- }
- }
- }
- Console.WriteLine();
- for (int i = 0; i < n; i++)
- {
- Console.WriteLine(A[i]);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement