Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <map>
- using namespace std;
- int main() {
- string line;
- getline(cin, line);
- map<int, int> results;
- while (line.length() != 0) {
- size_t punct = 0, index = line.find('|');
- for (size_t i = 0; i < line.substr(0, index).length(); i++) {
- if (ispunct(line[i])) {
- punct++;
- }
- }
- line.erase(0, index + 1);
- results[punct]++;
- }
- for (map<int, int>::iterator it = results.begin(); it != results.end(); it++) {
- cout << it->first << " symbol sentences: " << it->second << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement