Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Rus");
- freopen("input.txt", "r", stdin);
- string str;
- cin >> str;
- cout << "Начальная строка:" << "\n";
- cout << str << "\n";
- for (int i = 0; i < str.size(); i++) {
- if (isdigit(str[i])) {
- int index = stoi(str.substr(i, 1)) - 1;
- str[i] = str[index];
- }
- }
- cout << "Итоговая строка:" << "\n";
- cout << str << "\n";
- freopen("CON", "r", stdin); //возврат ввода через консоль
- system("PAUSE");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement