Untitled

mail@pastecode.io avatar
unknown
c_cpp
8 months ago
295 B
1
Indexable
Never
#include <iostream>
#include <string>
using namespace std;

string zamena(string x,char a,char b) {
	for (int i = 0; i < x.size(); i++) {
		if (x[i] == a) {
			x[i] = b;
		}
	}
	return x;
}

int main()
{
	string x;
	char a, b;
	cin >> x >> a >> b;
	cout << zamena(x, a, b);
} 
Leave a Comment