c program to right shift a string by 2 numbers
/*c,cpp program to right shift a string by n positions
(may be 1right, 2right, etc.)*/
#include <string>
using namespace std;
void main()
{
string str="apple";
int shift;
cout<<"Enter the number of shifts for the string to get shifted: ";
cin>>shfit;
int n=str.length();
for(int i=n+2;i>=shift;i--){
str[i]=str[i-shift];
}
//now the string is shifted by 'shift' positions "right".
}