题目链接
https://www.patest.cn/contests/pat-b-practise/1006
代码
#include<iostream>
#include<stack>
using namespace std;
int main() {
char a[2] = {'S', 'B'};
int n, x;
stack<int> s;
cin >> n;
while(n != 0) {
s.push(n % 10);
n /= 10;
}
while(!s.empty()) {
for(int i=0; i < s.top(); i++) {
if(s.size() == 1) {
for(int j = 1; j <= s.top(); j++) cout << j;
break;
}
else cout << a[s.size() - 2];
}
s.pop();
}
return 0;
}