Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <string>
- #include <map>
- using namespace std;
- int main()
- {
- ifstream input;
- input.open("dane_geny.txt");
- if(input.bad())
- {
- input.close();
- input.open("dane_gen.txt");
- }
- vector<string> gens;
- string tmp;
- while(input >> tmp)
- gens.push_back(tmp);
- map<int, int> genotypes;
- for(vector<string>::iterator i = gens.begin(); i != gens.end(); i++)
- {
- genotypes[i->length()]++;
- }
- int maks = 0, cnt = 0;
- for(map<int, int>::iterator i = genotypes.begin(); i != genotypes.end(); i++)
- {
- cnt++;
- if(maks < i->second) maks = i->second;
- }
- cout << cnt << " " << maks << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment