Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <map>
- using namespace std;
- int main()
- {
- string s;
- map<string, int> mapa;
- while(getline(cin, s))
- {
- for(int i=0; i<s.size(); i++)
- if(!(s[i] >= 'a' && s[i] <= 'z'))
- s[i] = ' ';
- stringstream ss;
- ss << s;
- while(ss >> s)
- mapa[s]++;
- }
- int tram = mapa["tram"];
- int trol = mapa["trolleybus"];
- if(tram == trol)
- cout << "Bus driver" << endl;
- else if(tram > trol)
- cout << "Tram driver" << endl;
- else
- cout << "Trolleybus driver" << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment