Cod sursa(job #2771773)

Utilizator SerbaP123Popescu Serban SerbaP123 Data 29 august 2021 10:10:08
Problema Text Scor 40
Compilator cpp-64 Status done
Runda PreOni 2005 Runda 1 Clasele 9-10 Marime 0.68 kb
#include <fstream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <bitset>
#define pb(a) push_back(a)
using namespace std;

ifstream cin("text.in");
ofstream cout("text.out");

string a;
int lungime;
int cuvinte;

bool is_digit(char a){
    return a >= 'A' && a <= 'Z' || a >= 'a' && a <= 'z';
}

int main(){
    getline(cin, a);
    for(int i = 0; i < a.size(); ++i){
        if(is_digit(a[i])){
            lungime++;
        }
    }
    for(int i = 0; i < a.size(); ++i){
        if(!is_digit(a[i]) && is_digit(a[i - 1])){
            cuvinte++;
        }
    }
    cout << lungime / cuvinte;
    return 0;
}