Cod sursa(job #1182865)
Utilizator | Data | 7 mai 2014 22:17:44 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
int cuvinte,i, litere,x;
char s[10001];
int main()
{
fin.getline(s,10001);
x=strlen(s);
for(i=0;i<x;i++)
{if((s[i]>='a'&&s[i]<='z')||(s[i]>='A'&&s[i]<='Z')) litere++;
if(strchr(" ,.:;!?-",s[i])&&((s[i-1]>='a'&&s[i-1]<='z')||(s[i-1]>='A'&&s[i-1]<='Z'))) cuvinte++;}
fout<<litere/cuvinte;
return 0;
}