makeway @ 2024-09-02 12:51:53
#include<bits/stdc++.h>
using namespace std;
string a;
bool k=true;
int main()
{
cin>>a;
while(k){
if(k=false)cout<<a.size();
else cout<<","<<a.size();
}
return 0;
}
by Yxy7952 @ 2024-09-02 13:02:49
@makeway
#include<bits/stdc++.h>
using namespace std;
string a;
bool k=true;
int main()
{
while(cin>>a){
if(k==true)cout<<a.size(),k=false;
else cout<<","<<a.size();
}
return 0;
}
by Zienith @ 2024-09-02 13:16:05
cin不读空格,一次读不完
by _liujunming_ @ 2024-09-16 17:42:28
#include<bits/stdc++.h>
using namespace std;
int main()
{
string a;
int ans=0;
getline(cin,a);
for(int i=0;i<a.size();i++)
{
if(a[i]==' '&&ans!=0)
{
cout<<ans<<",";
ans=0;
}
else if(a[i]!=' ')
{
ans++;
}
}
cout<<ans;
return 0;
}
by edu1219989010 @ 2024-09-28 16:24:23
nm