Cod sursa(job #696467)
Utilizator | Data | 28 februarie 2012 18:39:11 | |
---|---|---|---|
Problema | Text | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.43 kb |
#include <iostream.h>
#include <fstream.h>
ifstream f ("text.in");
ofstream g ("text.out");
int main() {
char t[1000];
int nc = 0, nl = 0, i, sw=0, med;
f.get(t, 1000);
for(i=0; i<=strlen(t); i++) {
if(t[i]>='a' && t[i]<='z' || t[i]>='A' && t[i]<='Z') {
nl++;
sw = 0;
}
else {
sw = 1;
}
if(sw && (t[i-1]>='a' && t[i-1]<='z' || t[i-1]>='A' && t[i-1]<='Z'))
nc++;
}
med = nl/nc;
g<<med;
}