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