#include <iostream> using namespace std; int main() { // 字符串 并接受用户的输入 string str; cin>>str; int countA,countB,countC; //定义并初始化三个计次变量 countA = 0; countB = 0; countC = 0; // 开始遍历字符串 for(int i = 0;i<str.length();i++){ if(str[i]=='a'){countA++;} if(str[i]=='b'){countB++;} if(str[i]=='c'){countC++;} } // 输出 cout<<countA<<" "<<countB<<" "<<countC; }