题解 | #字符的个数#
字符的个数
https://www.nowcoder.com/practice/dc28f2bf113a4058be888a5875206238
#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin>>s;
// write your code here......
int a=0,b=0,c=0;
int count=0;
while(s[count]!='\0'){
if(s[count] == 'a'){
a++;
}
if(s[count] == 'b'){
b++;
}
if(s[count] == 'c'){
c++;
}
count++;
}
cout<<a<<" "<<b<<" "<<c<<endl;
return 0;
}
查看6道真题和解析
