HTML & JS
// C++ program to demonstrate working of rotate
#include <bits/stdc++.h>
using namespace std;

int main()
{
    string str = "ABCD";
    
    // Rotating arround second element
    // string becomes "BCDA"
    rotate(str.begin(), str.begin()+1, str.end());
    cout << str << endl;
    
    // Again rotating around second element
    // string becomes "CDAB"
    rotate(str.begin(), str.begin()+1, str.end());
    cout << str;

    return 0;
}

Generated URL:

Output:

BCDA
CDAB
Report Bug