#include <iostream>
#include <cstring>
using namespace std;
int n, i, len; //n數字字符的數量,i, len是長度
char s[256];
int main ()
{
gets(s);
len = strlen(s); //求字符串長度,編譯不過?
for(int i = 0; i <= len-1; i++)
{
if(s[i] >= '0' && s[i] <= '9') n++;//
}
cout << n;//輸出兩個單詞
return 0;
}
|