Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- class Program
- {
- static void Main(string[] args)
- {
- string line = "";
- bool first = true;
- while ((line = Console.ReadLine()) != "0")
- {
- int n = int.Parse(line);
- if (n >= 1 && n <= 200)
- {
- List<string> Print = new List<string>();
- for (int i = 0; i < n; i++)
- {
- string input = Console.ReadLine();
- if (input.Length <= 2)
- input = input + " "; // lägger på 2 mellanslag om stringen är 1 lång
- Print.Add(input);
- };
- var sorted = Print.OrderBy(x => x.Remove(Math.Min(x.Length, 2))); // index 2 = 3:e platsen? 0, 1, 2. Stringen måste väl därför va minst 3? Därav plus 2 mellanslag ovan
- if (!first)
- {
- Console.WriteLine();
- }
- first = false;
- foreach (string name in sorted)
- {
- Console.WriteLine(name);
- }
- Console.WriteLine();
- }
- else
- {
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement