https://www.hackerrank.com/challenges/30-regex-patterns/problem
Day 28: RegEx, Patterns, and Intro to Databases Solution in Cpp
#include <bits/stdc++.h>
using namespace std;
vector<string> split_string(string);
int main()
{
list<string> names;
int N;
cin >> N;
for(int a0 = 0; a0 < N; a0++){
string firstName;
string emailID;
cin >> firstName >> emailID;
if ( emailID.find("@gmail.com") != std::string::npos ) {
names.push_front(firstName);
}
}
names.sort();
for (auto & name : names) {
cout << name << endl;
}
return 0;
}
0 Comments