Pagini recente » Cod sursa (job #630996) | Cod sursa (job #2404627) | Cod sursa (job #2157273) | Cod sursa (job #1705198) | Cod sursa (job #550990)
Cod sursa(job #550990)
#include <fstream.h>
#include <string.h>
char s[200005];
int nc,nt,nr,i,sw;
int main()
{
ifstream fin("text.in");
fin.get(s,200005,'\n');
fin.get();
i=0;
while(i<strlen(s))
{
while((s[i]<'a' || s[i]>'z') && (s[i]<'A' || s[i]>'Z') && i<strlen(s))
i++;
sw=0;
while((s[i]>='a' && s[i]<='z') || (s[i]>='A' && s[i]<='Z') && i<strlen(s))
{
i++;
nr++; sw=1;
}
nt+=nr;
if(sw)
nc++;
nr=0;
}
fin.close();
ofstream fout("text.out");
fout<<nt/nc;
fout.close();
return 0;
}