Cod sursa(job #1244197)
Utilizator | Data | 16 octombrie 2014 21:30:06 | |
---|---|---|---|
Problema | Text | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <fstream>
using namespace std;
ifstream f("text.in");
int main()
{
char x;
int nrc=0,nrl=0,ok=0;
while(f>>x)
{
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();
}