using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _09.BankAccount { class Program { static void Main(string[] args) { string input = Console.ReadLine(); List result = new List(); while (input != "end") { BankAccount currAcc = ReadAccount(input); result.Add(currAcc); input = Console.ReadLine(); } result = result.OrderByDescending(b => b.Balance).ThenBy(n => n.Bank.Length).ToList(); foreach (var item in result) { Console.WriteLine($"{item.Name} -> {item.Balance} ({item.Bank})"); } } private static BankAccount ReadAccount(string input) { string[] tokens = input.Split(new string[] { " | " }, StringSplitOptions.RemoveEmptyEntries).ToArray(); return new BankAccount { Name = tokens[1], Bank = tokens[0], Balance = decimal.Parse(tokens[2]) }; } } class BankAccount { public string Name { get; set; } public string Bank { get; set; } public decimal Balance { get; set; } } }