We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
//my firstr try before researching on regexintmain(){stringN_temp;getline(cin,N_temp);intN=stoi(ltrim(rtrim(N_temp)));map<string,string>mp;map<string,int>num;for(intN_itr=0;N_itr<N;N_itr++){stringfirst_multiple_input_temp;getline(cin,first_multiple_input_temp);vector<string>first_multiple_input=split(rtrim(first_multiple_input_temp));stringfirstName=first_multiple_input[0];stringemailID=first_multiple_input[1];boolisvalid=false;stringm=emailID.substr(emailID.length()-10,10);for(charc:emailID){if(((c>='a'&&c<='z')&&m=="@gmail.com")||c=='@'||c=='.'){isvalid=true;}isvalid=false;break;}}if(isvalid){autoit=num.find(firstName);if(it==num.end()){num[firstName]=1;}else{num[firstName]+=1;}mp[firstName]=emailID;}}for(autoit:mp){for(inti=0;i<num[it.first];i++){cout<<it.first<<endl;}}return0;}
Cookie support is required to access HackerRank
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 →