字符串移动,字符串为*号和26个字母的任意组合,把*都移动到最左侧,字母移动到右侧,顺序不变

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#define   MAX     256

void  move_stars(char* str) {
    int len = strlen(str) - 1;
    char* p = str + len;
    char* q = p;
    for (;len >= 0; --len, --q) {
        if (isalpha(*q)) {
            *p-- = *q;
        }
    }
    ++p;
    while (str != p) {
        *str++ = '*';
    }
}

int  main(void) {
    char  str[MAX];
    fgets(str, MAX, stdin);
    str[strlen(str)-1] = '