You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
423 B
21 lines
423 B
2 years ago
|
#include <bits/stdc++.h>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
string str;
|
||
|
cin >> str;
|
||
|
for (int i = 0; i < str.length();) {
|
||
|
//查找一样的
|
||
|
char a = str[i];
|
||
|
int count = 0;
|
||
|
//对于一样的就只记数不输出
|
||
|
while (str[i] == a && i < str.length()) {
|
||
|
count++;
|
||
|
i++;
|
||
|
}
|
||
|
cout << count << a;
|
||
|
}
|
||
|
return 0;
|
||
|
}
|