9dop

 avatar
user_1041599
c_cpp
a month ago
706 B
1
Indexable
2kolok_SP
#include <iostream>
#include <cctype>
#include <cstring>
#include <iomanip>
#include <cmath>
using namespace std;

int countSvrz(char* s) {
    char s_copy[100];
    strcpy(s_copy, s);
    const char* delimiters = " ,.!?;:";
    char* token = strtok(s_copy, delimiters);
    int count = 0;
    while (token != nullptr) {
        if (strlen(token) <= 3)
            count++;
        token = strtok(nullptr, delimiters);
    }
    return count;
}

int main() {
    char s[100];
    int max = 0;
    char maxStr[100];
    while (cin.getline(s, 100)) {
        if (countSvrz(s) > max) {
            max = countSvrz(s);
            strcpy(maxStr, s);
        }
    }
    cout << max << ": " << maxStr << endl;
}
Leave a Comment