#include <stdio.h>
#include <string.h>
int main() {
char str[100];
int words = 0, chars = 0;
for (int i
= 0; i
< strlen(str
); i
++) { if (str[i] != ' ' && str[i] != '\n') {
chars++;
}
if (str[i] == ' ' || str[i] == '\n') {
words++;
}
}
if (chars > 0) words++;
printf("Words: %d, Characters: %d\n", words
, chars
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KaW50IG1haW4oKSB7CiAgICBjaGFyIHN0clsxMDBdOwogICAgaW50IHdvcmRzID0gMCwgY2hhcnMgPSAwOwogICAgZmdldHMoc3RyLCAxMDAsIHN0ZGluKTsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgc3RybGVuKHN0cik7IGkrKykgewogICAgICAgIGlmIChzdHJbaV0gIT0gJyAnICYmIHN0cltpXSAhPSAnXG4nKSB7CiAgICAgICAgICAgIGNoYXJzKys7CiAgICAgICAgfQogICAgICAgIGlmIChzdHJbaV0gPT0gJyAnIHx8IHN0cltpXSA9PSAnXG4nKSB7CiAgICAgICAgICAgIHdvcmRzKys7CiAgICAgICAgfQogICAgfQogICAgaWYgKGNoYXJzID4gMCkgd29yZHMrKzsKICAgIHByaW50ZigiV29yZHM6ICVkLCBDaGFyYWN0ZXJzOiAlZFxuIiwgd29yZHMsIGNoYXJzKTsKICAgIHJldHVybiAwOwp9Cg==