Cod sursa(job #1781353)
| Utilizator | Data | 16 octombrie 2016 20:12:41 | |
|---|---|---|---|
| Problema | Text | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | simulare_emag_mediu_2016_runda1 | Marime | 0.63 kb |
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int litera(char chch){
if((chch>='a' && chch<='z')||(chch>='A' && chch<='Z')) return 1;
return 0;
}
int main()
{
ifstream f("text.in");
ofstream g("text.out");
int k=0,cuv=0,litere=0,i;
char charchar;
while(f.get(charchar))
{
if(litera(charchar))
{
litere++;
k++;
if(k==1)
{cuv++;}
}
else k=0;
}
if(cuv!=0)
g<<litere/cuv<<"\n";
else g<<"0"<<"\n";
return 0;
}
