Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <set>
- #include <map>
- #include <algorithm>
- using namespace std;
- pair<string, string> split(string s) {
- // разбиваем строку на сервер и запрос
- int p = (int)(find(s.begin() + 7, s.end(), '/') - s.begin());
- string s1 = s.substr(0, p);
- string s2 = s.substr(p);
- return make_pair(s1, s2);
- }
- int main() {
- map<string, set<string> > m1;
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- string s;
- cin >> s;
- auto t = split(s);
- m1[t.first].insert(t.second);
- }
- map<set<string>, vector<string> > m2;
- for (auto x: m1)
- m2[x.second].push_back(x.first);
- vector<vector<string> > v;
- for (auto x: m2)
- if (x.second.size() > 1)
- v.push_back(x.second);
- cout << v.size() << "\n";
- for (auto x : v) {
- for (auto y : x)
- cout << y << ' ';
- cout << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement