Cod sursa(job #2402249)
| Utilizator | Data | 10 aprilie 2019 15:18:40 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.46 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++;
str[i]=' ';
}
simbol=n-simbol;
istringstream ss(str);
while(ss>>word)
{
cuvinte++;
}
if(cuvinte==0)
cuvinte=1;
medie=simbol/cuvinte;
fout<<medie<<'\n';
return 0;
}
