Cod sursa(job #1403267)
| Utilizator | Data | 27 martie 2015 10:15:39 | |
|---|---|---|---|
| Problema | Text | Scor | 20 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.53 kb |
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
char t[256];
unsigned lit=0,cuv=0;
ifstream fin ("text.in");
ofstream fout ("text.out");
while(fin.get(t,255))
{
for(int i=0; i<strlen(t);i++)
{
if((t[i]>='a'&& t[i]<='z')||(t[i]>='A'&&t[i]<='Z'))
lit++;
else
if(t[i]==' '||t[i]=='-')
cuv++;
}
if(t[0]==' '|| t[0]=='-')
cuv--;
}
fout<<lit/cuv;
fin.close();
fout.close();
return 0;
}
