Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string str;
- cout << "string>";
- cin >> str;
- size_t n = 0;
- cout << "n>";
- cin >> n;
- if (n > str.size() / 2)
- {
- cout << "Error: N is too big, or string is too small" << endl;
- return 0;
- }
- //cout << str.substr(0, n) << str.substr(n, str.size() - n - 2) << str.substr(str.size() - n) << endl;
- cout << str.substr(str.size() - n) << str.substr(n, str.size() - n - 2) << str.substr(0, n) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment