Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <queue>
- #include <map>
- #include <set>
- #include <cmath>
- //#include<bits/stdc++.h>
- //#define int long long
- #define pb push_back
- using namespace std;
- bool isInt(char a)
- {
- for(int i = 0; i < 10; i++)
- if(a - '0' == i)
- return true;
- return false;
- }
- signed main()
- {
- int t;
- cin >> t;
- vector<string> schools,ans;
- while(t--)
- {
- string s;
- string str="";
- getline(cin,s);
- for(auto i: s)
- if(isInt(i))
- str+=i;
- schools.pb(str);
- }
- int cnt = 1;
- sort(schools.begin(),schools.end());
- for(int i = 1; i < schools.size(); i++)
- {
- if(schools[i-1] == schools[i])
- cnt++;
- else
- {
- if(cnt <= 5)
- ans.pb(schools[i-1]);
- cnt = 1;
- }
- }
- cout << ans.size() << "\n";
- for(auto i: ans)
- cout << i << "\n";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement