23 lines
420 B
C
23 lines
420 B
C
#include <stdio.h>
|
|
#include <wchar.h>
|
|
#include <locale.h>
|
|
int main() {
|
|
setlocale(LC_ALL, "");
|
|
float ch = 0,words = 0,o = 0;
|
|
wchar_t x;
|
|
while((x = getwchar()) != WEOF){
|
|
switch(x){
|
|
case ' ':
|
|
ch += o;
|
|
if(o>0) words++;
|
|
o = 0;
|
|
break;
|
|
default:
|
|
o++;
|
|
}
|
|
}
|
|
|
|
printf("\nch per word - %.2f\n",ch/words);
|
|
return 0;
|
|
}
|