#include <iostream>
#include <ctype.h>
using namespace std;
//
void ReArrange(char *begin, char*end)
{
char *p, *digit , *other;
//指针digit指向最后一个数字,指针other指向第一个非字母数字
digit = begin - 1;
other = end + 1;
for (p = begin; p != other; ++p)
{
if (isalpha(*p)) //如果是字母
NULL;
else if (isdigit(*p))//如果是数字,与第一个字母(即digit+1)互换
{
digit++;
swap(*p, *digit);
}
else //如果是其他符号,与最后那个字母(即other-1)互换
{
other--;
swap(*p, *other);
p--;
}
}
}
int main()
{
char data[]="asfdf12fdf65*()&4fyak%";
ReArrange(data, data+strlen(data)-1);
cout << data << endl;
return 0;
}