View Code of Problem 3496

#include<bits/stdc++.h>
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;
	} 
}
/*
F:\temp\22489043.22573\Main.cc:2:24: error: bits/stdc++.h: No such file or directory
F:\temp\22489043.22573\Main.cc: In function 'int main()':
F:\temp\22489043.22573\Main.cc:5: error: 'string' was not declared in this scope
F:\temp\22489043.22573\Main.cc:5: error: expected ';' before 's'
F:\temp\22489043.22573\Main.cc:6: error: 'cin' was not declared in this scope
F:\temp\22489043.22573\Main.cc:6: error: 's' was not declared in this scope
F:\temp\22489043.22573\Main.cc:6: error: 'getline' was not declared in this scope
F:\temp\22489043.22573\Main.cc:7: error: 's1' was not declared in this scope
F:\temp\22489043.22573\Main.cc:9: error: 's3' was not declared in this scope
F:\temp\22489043.22573\Main.cc:11: error: 's2' was not declared in this scope
F:\temp\22489043.22573\Main.cc:15: error: 'cout' was not declared in this scope
F:\temp\22489043.22573\Main.cc:15: error: 's3' was not declared in this scope
F:\temp\22489043.22573\Main.cc:15: error: 'endl' was not declared in this scope
*/

Double click to view unformatted code.


Back to problem 3496