AK47N @ 2024-11-13 20:19:44
#include<bits/stdc++.h>
using namespace std;
int n,cnt=0;
int main()
{
string s;
cin>>s;
n=s.size();
for(int i=0;i<=n-1;i++){
if(s[i]>='A'&&s[i]<='Z'||s[i]>='a'&&s[i]<='z')
{
cnt=cnt+1;
}
}
cout<<cnt;
return 0;
}
by AK47N @ 2024-11-13 20:20:15
995
by chen_z @ 2024-11-13 20:21:44
@AK47N 帅哥你看题了不?
by AK47N @ 2024-11-13 20:23:55
请各位大佬别喷我
by AK47N @ 2024-11-13 20:24:30
@chen_z 看了
by TonviaSzt @ 2024-11-13 20:24:54
那我们用getline吧
by AK47N @ 2024-11-13 20:27:02
@TonviaSzt So?
by TonviaSzt @ 2024-11-13 20:27:44
@AK47N
string不支持读入带空格的一行,可以这样:
while(cin>>s){
}
by chen_z @ 2024-11-13 20:27:44
@AK47N 你可以 while(cin>>s)
by TonviaSzt @ 2024-11-13 20:28:23
@AK47N 然后记得输出逗号
by AK47N @ 2024-11-13 20:29:35
@chen_z @TonviaSzt 谢谢,已关