Cod sursa(job #2402252)
Utilizator | Data | 10 aprilie 2019 15:23:11 | |
---|---|---|---|
Problema | Text | Scor | 40 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include<bits/stdc++.h>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int n,medie,simbol,cuvinte;
string str;
string word;
int main()
{
getline(fin,str);
n=str.size();
for (int i=0;i<n;i++)
if (isalpha(str[i]))
{
simbol++;
if (i==0)
cuvinte++;
else
if (!isalpha(str[i-1]))
cuvinte++;
}
medie=simbol/cuvinte;
fout<<medie<<'\n';
return 0;
}