#include<stdio.h>
#include<string.h>
char *Sort(char *str, int len)
{
if(str==NULL || len<=0 )
return NULL;
char *start = str;
int i = len - 1;
int j = 0;
int l = 0;
for(; i>=0; i--)
{
if(str[i]>='A' && str[i]<='Z')
{
char t = str[i];
int k = i;
for(; k<len-1-l; k++)
str[k] = str[k+1];
str[k] = t;
l++;
}
}
return start;
}
int main()
{
char s[] = "";//"aFkJmnVp";
char *ret = Sort(s, strlen(s));
if(ret!=NULL)
{
printf("%s\n", ret);
}
else
{
printf("error!\n");
}
return 0;
}
把一个字符串的大写字母放到字符串的后面,各个字符的相对位置不变,不能申请额外的空间
最新推荐文章于 2020-04-22 17:53:55 发布