Cod sursa(job #761186)
| Utilizator | Data | 25 iunie 2012 03:29:46 | |
|---|---|---|---|
| Problema | Text | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.49 kb |
#include <fstream>
#include <stdio.h>
#include <cstdlib>
#include <string>
using namespace std;
char c[1024*1024];
unsigned cuv, lcuv;
bool ok=true;
fstream f;
int main()
{
f.open("text.in", ios::in);
f.getline(c, 1024*1024);
f.close();
f.clear();
for(int i=0; i<strlen(c); i++)
{
if(c[i]>='A' && c[i]<='z')
{
lcuv++;
if(ok)
cuv++;
ok=false;
}
else
ok=true;
}
f.open("text.out", ios::out);
f << lcuv/cuv << endl;
f.close();
}