You are viewing a single comment's thread. Return to all comments →
function printArray<T>(array: T[]): void { for (let i = 0; i < array.length; i++) { console.log(array[i]); } } function main() { const N: number = parseInt(readLine().trim(), 10); const arrPerson: string[] = new Array(); const regexGmail: RegExp = /^[a-z.]+@gmail\.com$/; for (let NItr: number = 0; NItr < N; NItr++) { const firstMultipleInput: string[] = readLine().replace(/\s+$/g, '').split(' '); const firstName: string = firstMultipleInput[0]; const emailID: string = firstMultipleInput[1]; if (emailID.match(regexGmail)) { arrPerson.push(firstName); } } arrPerson.sort(); printArray(arrPerson); }
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 →
TypeScript/JavaScript