Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- #include <algorithm>
- #include <functional>
- using namespace std;
- int main()
- {
- int school [100] = {};
- short count;
- ifstream fin("input.txt");
- {
- string line;
- string str1;
- string str2;
- int num;
- bool b = true;
- while (b)
- {
- getline(fin, line);
- if(line == "")
- {
- b = false;
- }
- else
- {
- stringstream x;
- x << line;
- x >> str1 >> str2 >> num >> count;
- school[num]++;
- }
- }
- }
- fin.close();
- int max = 0;
- for(int i = 1; i<=99 ; i++)
- {
- if(school[i] > max)
- {
- max = school[i];
- }
- }
- ofstream fout("output.txt");
- count = 0;
- for(int i = 1; i<100 ; i++)
- {
- if(school[i] == max )
- {
- if(count == 0) {
- count++;
- fout << i;
- }
- else
- {
- fout << ' '<< i;
- }
- }
- }
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement