ํ์ด
// ๋ฌธ์์ด ์์ถ
#include <iostream>
#include <string>
using namespace std;
string solution(string input){
string answer = "";
int cnt=0;
if (input[0] == '1')
answer += "1";
for (int i=0; i<input.length() - 1; i++){
if (input[i] != input[i+1]){
//answer += (char)(cnt+65);
if (cnt >= 26)
answer += 'Z';
else
answer += 'A'+cnt;
cnt = 0;
}
else {
cnt++;
}
}
answer += 'A'+cnt; // ๋ง์ง๋ง ๋ฌธ์ ์ ์ฅ
return answer;
}
int main() {
char input[100];
cin >> input;
string answer = solution(input);
cout << answer;
return 0;
}
'โจ Algorithm' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค/C++] 1026๋ฒ : ๋ณด๋ฌผ (0) | 2021.09.06 |
---|---|
[๋ฐฑ์ค/C++] 13305๋ฒ : ์ฃผ์ ์ (0) | 2021.09.02 |
[EPPER/C++] ๋ง์๋ผ OX (0) | 2021.08.31 |
[EPPER/C++] 14ํ : ์ ๋ฌธ ๊ธฐ์ฌ (0) | 2021.08.31 |
[๋ฐฑ์ค/C++] 13458๋ฒ : ์ํ ๊ฐ๋ (0) | 2021.08.30 |
๋๊ธ