Cod sursa(job #1313941)
| Utilizator | Data | 11 ianuarie 2015 12:35:27 | |
|---|---|---|---|
| Problema | Text | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva de probleme | Marime | 0.67 kb |
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("text.in");
ofstream fout("text.out");
char s[1000], cuv[255];
int i, nrcuv, nrlitere, k;
int main()
{
fin.getline(s, 1000);
i=0;
nrcuv=0;
nrlitere=0;
while(s[i]!=NULL)
{
while(strchr(" ,./?:;!-", s[i])!=NULL&&s[i]!=NULL) i++;
k=0;
while(strchr(" ,./?:;!-", s[i])==NULL&&s[i]!=NULL)
{
cuv[k++]=s[i++];
}
if(k!=0)
{
cuv[k]='\0';
nrlitere+=strlen(cuv);
nrcuv++;
}
}
nrcuv=nrlitere/nrcuv;
fout<<nrcuv;
return 0;
}
