Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <cstring>
- #include <cstdio>
- #include <cstdlib>
- #include <functional>
- #include <numeric>
- #include <algorithm>
- using namespace std;
- int main() {
- string str, s;
- int sum = 0;
- while (getline(cin, str)) {
- transform(str.begin(), str.end(), str.begin(), [](char c) { return isalpha(c) ? c : ' '; });
- 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