You are viewing a single comment's thread. Return to all comments →
Mine in C#
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text.RegularExpressions; class Solution { static List<string> Names = new List<string>(); static string pattern = "@gmail.com$"; static void Main(String[] args) { int N = Convert.ToInt32(Console.ReadLine()); for(int a0 = 0; a0 < N; a0++){ string[] tokens_firstName = Console.ReadLine().Split(' '); string firstName = tokens_firstName[0]; string emailID = tokens_firstName[1]; Regex rgx = new Regex(pattern); if(rgx.IsMatch(emailID)) { Names.Add(firstName); } } Names.Sort(); foreach(string name in Names) { Console.WriteLine(name); } } }
Day 28: RegEx, Patterns, and Intro to Databases
You are viewing a single comment's thread. Return to all comments →
Mine in C#