Cod sursa(job #159873)
| Utilizator | Data | 14 martie 2008 14:44:37 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.5 kb |
#include <string.h>
#include <fstream>
using namespace std;
int main()
{
char text[1048576];
ifstream read("text.in");
ofstream write("text.out");
read.getline(text, 1048576);
unsigned int length = strlen(text);
unsigned int i, litere = 0, cuvinte = 0;
for(i = 0; i < length; ++i)
if (isalpha(text[i]))
litere++;
else if(i>=1 && i<length-1 && isalpha(text[i-1]) && isalpha(text[i+1]))
cuvinte++;
write << litere / cuvinte;
return 0;
}
