http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0017&lang=jp
#include <iostream> #include <string> using namespace std; bool hoge (string read) { if (read.find("this") != string::npos) { return 0; }else if (read.find("that") != string::npos) { return 0; }else if (read.find("the") != string::npos) { return 0; } return 1; } int main (int argc, const char * argv[]) { string read; while (getline(cin,read)) { for (int j=0;hoge(read);j++) { for (int i=0; i < read.size(); i++) { if(read[i] == 'z') { read[i] = 'a'; }else if(read[i] == ' ' || read[i] == '.') { }else { read[i] = read[i] + 1; } } } cout << read << "\n"; } return 0; }