Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- string in, out;
- int lenght, i, j;
- setlocale(LC_ALL, "Russian");
- cout << "Введите строку: ";
- getline(cin, in);
- lenght = in.length();
- out = in;
- for (i = 1, j = 0; i < lenght; i += 2, j++)
- out[j] = in[i];
- for (i = 0, j = lenght-1; i < lenght; i += 2, j--)
- out[j] = in[i];
- cout << out;
- }
Advertisement
Add Comment
Please, Sign In to add comment