一层层考虑,注意特殊情况即可(c++)

#include<math.h>
using namespace std;
char a[110];
char b[10000];
int cnt;
int main()
{
    int p1, p2, p3;
    cin >> p1 >> p2 >> p3;
    cin >> a;
    for (int i = 0; i < 101; i++)
    {
       
            if (a[i] >= 'a' && a[i] <= 'z')
                b[cnt++] = a[i];
            else   if (a[i] >= '0' && a[i] <= '9')
                b[cnt++] = a[i]; 
              else if (a[i]== '-'&&i==0|| a[i] == '-' && (a[i+1] == '-'|| a[i - 1] == '-') ) b[cnt++] = '-';
                 else   if (a[i] == '-')

                     if (a[i - 1] >= 'a' && a[i - 1] <= 'z' && a[i + 1] >= '0' && a[i + 1] <= '9' || a[i + 1] >= 'a' && a[i + 1] <= 'z' && a[i - 1] >= '0' && a[i - 1] <= '9')
                      b[cnt++] = '-';
              
                else    if (a[i - 1] < a[i + 1])
            {
                if (p3 == 1)
                {
                    if (p1 == 1)
                        if (a[i-1] >= 'a' && a[i-1] <= 'z')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = a[i - 1] + j;
                        else if (a[i-1] >= '0' && a[i-1] <= '9')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = a[i - 1] + j;
                    if (p1 == 2)
                        if (a[i-1] >= 'a' && a[i-1] <= 'z')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = a[i - 1] + j - 32;
                        else if (a[i-1] >= '0' && a[i-1] <= '9')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = a[i - 1] + j;
                    if (p1 == 3)
                        if (a[i-1] >= 'a' && a[i-1] <= 'z')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = '*';
                        else if (a[i - 1] >= '0' && a[i - 1] <= '9')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = '*';
                }

                if (p3 == 2)
                {
                    if (p1 == 1)
                        if (a[i - 1] >= 'a' && a[i - 1] <= 'z')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = a[i + 1] - j;
                        
                        else if (a[i - 1] >= '0' && a[i - 1] <= '9')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = a[i + 1] - j;
                    if (p1 == 2)
                        if (a[i - 1] >= 'a' && a[i - 1] <= 'z')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = a[i + 1] - j - 32;
                       
                        else if (a[i - 1] >= '0' && a[i - 1] <= '9')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = a[i + 1] - j;
                    if (p1 == 3)
                        if (a[i - 1] >= 'a' && a[i - 1] <= 'z')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = '*';
                        
                        else if (a[i - 1] >= '0' && a[i - 1] <= '9')
                            for (int j = 1; j <= a[i + 1] - a[i - 1] - 1; j++)
                                for (int l = 0; l < p2; l++)
                                    b[cnt++] = '*';

                }
            }
            else b[cnt++] = '-';
           
    }

    for (int i = 0; i < cnt; i++)
    {
        cout << b[i];
    }
    return 0;
}