Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- map<string, vector<string> > mp;
- int main() {
- int n; cin >> n;
- string s;
- string ss;
- for(int q = 0 ; q < n ; q++) {
- cin >> s;
- ss = s;
- for(int i = 0 ; i < ss.size() ; i++) {
- if(s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
- }
- string x = "", y = "";
- bool sy = false;
- for(int i = 0; i < s.size() ; i++) {
- if(s[i] == '@') {
- sy = true;
- continue;
- }
- if(!sy) x += s[i];
- else y += s[i];
- }
- if(y == "bmail.com") {
- string new_x = "";
- for(int i = 0 ; i < x.size() ; i++) {
- if(x[i] == '+') break;
- if(x[i] == '.') continue;
- new_x += x[i];
- }
- string z = new_x + "@" + y;
- mp[z].push_back(ss);
- } else {
- mp[s].push_back(ss);
- }
- }
- cout << mp.size() << "\n";
- for(map<string, vector<string> >::iterator it = mp.begin() ; it != mp.end() ; ++it) {
- cout << it->second.size() << " ";
- for(vector<string>::iterator i = it->second.begin() ; i != it->second.end() ; ++i) {
- cout << *i << " ";
- }
- cout << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement