6-3. 单词长度(15)

来源:互联网 发布:指标数据标准化 编辑:程序博客网 时间:2024/05/20 15:11
#include <stdio.h>#include <string.h>#define STRING_SIZE 1000int main() {char str[STRING_SIZE + 1];char *i ;int len ;gets(str);i = strtok(str, " .") ;while(i != NULL) {len = strlen(i) ;i = strtok(NULL, " .") ;if(i != NULL)printf("%d ", len);elseprintf("%d", len);}    return 0;}


0 0
原创粉丝点击