题解
2023-08-26 17:45:46
发布于:广东
6阅读
0回复
0点赞
#include <iostream>
#include <cctype>
using namespace std;
int main() {
string input;
cin >> input;
char current_char = input[0];
int count = 1;
for (size_t i = 1; i < input.length(); ++i) {
if (toupper(input[i]) == toupper(current_char)) {
count++;
} else {
cout << "(" << char(toupper(current_char)) << "," << count << ")";
current_char = input[i];
count = 1;
}
}
cout << "(" << char(toupper(current_char)) << "," << count << ")";
return 0;
}
这里空空如也
有帮助,赞一个