题解 | #统计单词#
统计单词
https://www.nowcoder.com/practice/11c6e7c9987c4ab48f8cdd8834c27064
#include <stdio.h> // 考虑了多个空格 int main() { char str[50]; while(scanf("%s", str) != EOF){ int i=0; while(str[i] != '\0') i++; if(str[i-1] == '.') printf("%d ", i-1); else printf("%d ", i); } return 0; }