solution.cpp 529 字节
Newer Older
每日一练社区's avatar
每日一练社区 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#include <bits/stdc++.h>
using namespace std;
char s2[100000];
int main()
{
    char s1[150];
    cin >> s1;

    int top = 0;
    for (int i = 0; s1[i] != '\0'; i++)
    {
        if ((s1[i] >= 'A' && s1[i] <= 'Z') || (s1[i] >= 'a' && s1[i] <= 'z'))
        {
            s2[top++] = s1[i];
        }
        else
        {
            while (s1[i] != '1')
            {
                s2[top++] = s1[i - 1];
                s1[i] = s1[i] - 1;
            }
        }
    }
    s2[top] = '\0';

    cout << s2;
    return 0;
}