1 2 3 4 5 6 7 8 9
int c=0; int n=0; int x=0; while((c=getchar())!=EOF){ if(c==' ')++n; else ++x; } cout<<"цифр-"<<x<<"probel-"<<n;