i tried to solve this question using swapping technique but got wrong output.
int main()
{
char s[30]="hello";
int k;
char ch,x;
cin>>k;
int l=strlen(s);
for(int i=0;i<=l/2;i++)
{
ch=s[i];
s[i]=s[i+k];
s[i+k]=ch;
}
for(int i=(l/2)+1;i<l;i++)
{
x=s[i];
s[i]=s[i-k-1];
s[i-k-1]=x;
}
cout<<s;
}