Untitled

mail@pastecode.io avatar
unknown
c_cpp
8 months ago
362 B
0
Indexable
Never
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
string oleg(string n, int a, int b) {
    int n1 = n[a];
    int n2 = n[b];
    n[a] = n2;
    n[b] = n1;
    return n;
}

int main()
{
    int a;
    int b;
    cin >> a >> b;
    a = a-1;
    b = b-1;
    string n;
    cin >> n;
    cout << oleg(n, a, b);
}
Leave a Comment