You are viewing a single comment's thread. Return to all comments →
In C#
class Solution { public static void Main(string[] args) { int N = Convert.ToInt32(Console.ReadLine().Trim()); List<string> names = new List<string>(); for (int NItr = 0; NItr < N; NItr++) { string[] firstMultipleInput = Console.ReadLine().TrimEnd().Split(' '); string firstName = firstMultipleInput[0]; string emailID = firstMultipleInput[1]; var regex = new Regex("[A-Za-z._]+@gmail.com"); if(regex.IsMatch(emailID)) { names.Add(firstName); } } names.Sort(); names.ForEach(n => Console.WriteLine(n)); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Day 28: RegEx, Patterns, and Intro to Databases
You are viewing a single comment's thread. Return to all comments →
In C#