View Code of Problem 3496

#include<iostream>
using namespace std;
int main() {
	string s,s1="you",s2="we",s3;
	while(getline(cin,s)) {
		int index=s.find(s1);
		while(index!=-1) {
			s3="";
			for(int i=0; i<index; i++) s3+=s[i];
			s3+=s2;
			for(int i=index+3; i<s.length(); i++) s3+=s[i];
			index=s.find(s3);
		}
		cout<<s3<<endl;
	} 
}

Double click to view unformatted code.


Back to problem 3496