Pagini recente » Cod sursa (job #2474141) | Cod sursa (job #2603760) | Cod sursa (job #2454318) | Cod sursa (job #2459146) | Cod sursa (job #793794)
Cod sursa(job #793794)
#include<fstream>
#include<string>
using namespace std;
ifstream f("test.in");
ofstream o("test.out");
string mes;
char c;
int main()
{
getline(f,mes);
int words=1,totlength=0,i=0;
while(!((mes[i]>='A'&&mes[i]<='Z')||(mes[i]>='a'&&mes[i]<='z')))
{i++;}
for(;i<mes.length();i++)
{
if(mes[i]==' '||mes[i]=='-')
words++;
else
if((mes[i]>='A'&&mes[i]<='Z')||(mes[i]>='a'&&mes[i]<='z'))
totlength++;
}
o<<totlength/words;
return 0;
}