Cod sursa(job #1292174)
Utilizator | Data | 13 decembrie 2014 19:32:54 | |
---|---|---|---|
Problema | Text | Scor | 100 |
Compilator | cpp | Status | done |
Runda | runda2014_14 | Marime | 0.53 kb |
#include <fstream>
using namespace std;
ifstream f("text.in");
int main()
{
char x;
int nrc=0,nrl=0,ok=0;
while(f.get(x))
{
if(x==' ')
ok=0;
else
if((x>='a' && x<='z')||(x>='A' && x<='Z'))
{
nrl++;
if(ok==0)
{
nrc++;
ok=1;
}
}
else
{
ok=0;
}
}
f.close();
ofstream g("text.out");
g<<nrl/nrc;
g.close();
}