View Code of Problem 3496

#include <bits/stdc++.h>
using namespace std;

//replace()函数的使用

int main() {
	string s;

	while (getline(cin, s)) {
		while (s.find("you") != -1) {
			s.replace(s.find("you"), 3, "we");
		}
		cout << s;
	}
	
	return 0;
}


/*
F:\temp\22495107.28637\Main.cc:2:25: error: bits/stdc++.h: No such file or directory
F:\temp\22495107.28637\Main.cc: In function 'int main()':
F:\temp\22495107.28637\Main.cc:8: error: 'string' was not declared in this scope
F:\temp\22495107.28637\Main.cc:8: error: expected ';' before 's'
F:\temp\22495107.28637\Main.cc:10: error: 'cin' was not declared in this scope
F:\temp\22495107.28637\Main.cc:10: error: 's' was not declared in this scope
F:\temp\22495107.28637\Main.cc:10: error: 'getline' was not declared in this scope
F:\temp\22495107.28637\Main.cc:14: error: 'cout' was not declared in this scope
*/

Double click to view unformatted code.


Back to problem 3496