C++我这个程序哪里有问题运行结果也没有问题

img

char shuzi[100];
char zimu[100];
char ZiMu[100];
char str[100];

while(scanf("%s",str))
{

int x = 0;
int nums = 0;
int numz = 0;
int numZ = 0;
char buf;
while (str[x]!='\0')      //a5b4c3
{
    if (str[x]>='0'&&str[x]<='9')
    {
        shuzi[nums] = str[x];
        nums++;
        str[x] = '0';
    }
    if (str[x] >= 'a' && str[x] <= 'z')
    {
        zimu[numz] = str[x]; //zimu0=str0=a
        numz++;
        str[x] = 'a';  //str0=a
    }
    if (str[x] >= 'A' && str[x] <= 'Z')
    {
        ZiMu[numZ] = str[x];
        numZ++;
        str[x] = 'A';
    }
    x++;
}
for (int i = 0; i < nums - 1; i++)
{
 
    for (int j = 0; j < nums - 1 - i; j++)  
    {
        if (shuzi[j] > shuzi[j + 1])
        {
            buf = shuzi[j];
            shuzi[j] = shuzi[j + 1];
            shuzi[j + 1] = buf;
        }
    }
}
for (int i = 0; i < numz - 1; i++)
{
    
    for (int j = 0; j < numz - 1 - i; j++)  
    {
        if (zimu[j] > zimu[j + 1])
        {
            buf = zimu[j];
            zimu[j] = zimu[j + 1];
            zimu[j + 1] = buf;
        }
    }
}
for (int i = 0; i < numZ - 1; i++)
{
   
    for (int j = 0; j < numZ - 1 - i; j++) 
    {
        if (ZiMu[j] > ZiMu[j + 1])
        {
            buf = ZiMu[j];
            ZiMu[j] =ZiMu[j + 1];
            ZiMu[j + 1] = buf;
        }
    }
}
x = 0;
nums = 0;
numz = 0;
numZ = 0;
while (str[x] != '\0')
{
    if (str[x] == '0')
    {
        str[x] = shuzi[nums];
        nums++;
    }
    if (str[x] == 'a')
    {
        str[x] = zimu[numz];
        numz++;
    }
    if (str[x] == 'A')
    {
        str[x] = ZiMu[numZ];
        numZ++;
    }
    x++;
}
printf("%s\n",str);

}

img

字符串最大长度1000000,定义【100】的存放空间不足