Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 months ago
392 B
0
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

void name(string &nam) {
    int i = 0;
    while (i <= nam.size()) {
        if (nam[i] == 'o') {
            nam[i] = 'a';
        }
        else if (nam[i] == 'a') {
            nam[i] = 'o';
        }

        i++;
    }
    cout << nam;
}

int main()
{
    string nam;
    cin >> nam;
    name(nam);
}
Leave a Comment