题解 | #字符的个数#
字符的个数
https://www.nowcoder.com/practice/dc28f2bf113a4058be888a5875206238
#include<bits/stdc++.h> using namespace std; int main(){ string s; cin>>s; int a = 0; int b = 0; int c = 0; // write your code here...... for(int i = 0; s[i]!='\0'; i++){ s[i]=='a'?a++: s[i]=='b'?b++:c++; } cout << a << ' ' << b << ' ' << c << endl; return 0; }