1073. 几位数?

南昌大学陈睿思小朋友

人生苦短 我用 python
while True:
try:
a=int(input())
b=len(str(a))
print(b)
except:
break

Mambo_X

include

int main()
{
int n = 1;
char ch;

while ((ch = getchar()) != EOF){
    while((ch=getchar())!= '\n')
        n += 1;
    printf("%d\n", n);
    n = 1;
}
return 0;

}

10165101104

怎么一直wa啊???

Deuchie
#include <iostream>
#include <string>
using namespace std;

int main() {
    string a;
    while (cin >> a)
        cout << a.size() << '\n';
}
Deuchie

甚至还可以再短一点:

#include <iostream>
#include <string>
int main() {
    for (std::string str; std::cin >> str;)
            std::cout << str.size() << '\n';
}
td19220227

用Sring老快了

include

using namespace std;
int main(){
string a;
while(getline(cin,a))
cout << a.length() << endl;
return 0;
}

zuozug

c++参考代码:

include

include

using namespace std;
int main()
{
char a[1024];
int count;
while(gets(a))
{
count=0;
for(int sc=0;sc<1024;sc++)
{
if(a[sc]==’\0’)
break;
else
count++;
}
printf(“%d\n”,count);
}
return 0;
}

你当前正在回复 博客/题目
存在问题!