题解
2023-08-15 13:12:36
发布于:浙江
2阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main(){
string str;
cin >> str;
string s;
string sum = "";
int count = 1;
for (int i = 0;i < str.size();i ++){
if (tolower(str[i]) == tolower(str[i + 1]) && i + 1 < str.size()){
count += 1;
}
else{
s = tolower(str[i]);
for(int i = 0;i < s.size();i++){
if(s[i] <= 'z' && s[i] >= 'a'){
s[i] -= 32;
}
}
cout << '(';
cout << s ;
cout << ",";
cout << count;
cout << ")";
count = 1;
}
}
cout << endl;
return 0;
}
这里空空如也
有帮助,赞一个