#1611: 差一個測試點


bruce71135 (Taco)


#include<iostream.h>
#include<ctype.h>
int main()
{

    int space=0;
    char str[80];
    cin.getline(str,80,'\n');

    int len = strlen(str);
    for(int x=0; x<=len; x++)
    if(isspace(str[x])!=0)
    space++;
    cout<<space+1;

    system("pause");
    return 0;
}

我只差在第一個測試點

我的答案是12

正確答案是11

我是用空白字元+1來計算字串的個數

 

 

 

 

 

 

 

#1612: Re:差一個測試點


asin0622 (小金仔)


問題說a-z連起來的才是 word

asdf!!asdf 沒空格的話答案是那個字,只算空白應該不行