Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cctype>
- #include <iostream>
- #include <sstream>
- int main() {
- std::string line;
- int amount_lines = 0, amount_words = 0, amount_letters = 0;
- while (std::getline(std::cin, line)) {
- std::stringstream ss(line);
- std::string word;
- while (ss >> word) {
- ++amount_words;
- for (auto ch : word) {
- if (std::isalpha(ch)) {
- ++amount_letters;
- }
- }
- }
- ++amount_lines;
- }
- std::cout << amount_lines << "\n";
- std::cout << amount_words << "\n";
- std::cout << amount_letters << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement