Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- public class StudentsByFirstAndLastName
- {
- public static void Main()
- {
- string input;
- var students = new List<string>();
- while ((input = Console.ReadLine()) != "END")
- {
- var tokens = input
- .Split();
- students.Add($"{tokens[0]} {tokens[1]}");
- }
- var result = students
- .Select(s =>
- {
- var tokens = s.Split();
- var firstName = tokens[0];
- var secondName = tokens[1];
- return new { firstName, secondName };
- })
- .Where(x => x.firstName.CompareTo(x.secondName) == -1)
- .ToList();
- foreach (var st in result)
- {
- Console.WriteLine($"{st.firstName} {st.secondName}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement