Cod sursa(job #2850540)

Utilizator YosifIosif Andrei Stefan Yosif Data 16 februarie 2022 22:31:26
Problema Text Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <bits/stdc++.h>
using namespace std;
int letter(char c) {
    return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
int main() {
    ifstream fin("number.in");
    ofstream fout("number.out");
    string s, c;
    getline(fin, s);
    int nrc = 0, nrl = 0, lg = s.length(), i = 0;
    while (i < lg && !letter(s[i]))
        i++;
    while (i < lg)
    {
        while (i < lg && letter(s[i]))
            c = c + s[i++], nrl++;
        nrc++;
        while (i < lg && !letter(s[i]))
            i++;
    }
    fout << nrl << ' ' << nrc;
    return 0;
}