#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> #include <string.h> void reserve(char *left,char*right) { while (left < right) { char tmp = *left; *left = *right; *right = tmp; left++; right--; } } int main() { char arr[10] = "AABCD"; int len = strlen(arr)-1; int k = 0; char *pstart = &arr[0]; char *pend = arr+len; scanf("%d", &k); reserve(pstart, pstart + k -1); reserve(pstart + k, pend); reserve(pstart, pend); printf("%s\n", arr); system("pause"); return 0; }