Cod sursa(job #1416033)
Utilizator | Data | 7 aprilie 2015 09:09:17 | |
---|---|---|---|
Problema | Text | Scor | 30 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.46 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream f("text.in");
ofstream g("text.out");
char s[256];
int nrl,nrc,i,ok;
int main()
{
f.get(s,256);
for(i=1;i<=strlen(s);i++)
{
if((s[i]<='Z'&&s[i]>='A')||(s[i]<='z'&&s[i]>='a'))
{
nrl++;
ok=1;
}
if((s[i]==' '||s[i]=='-')&&ok)
nrc++;
}
nrc++;
g<<nrl/nrc;
g.close();
return 0;
}