POJ_3510_A Tale from the Dark Side of the Moon

#include <iostream> #include <string> using namespace std; int main() { freopen("test.txt", "r", stdin); while(true) { string s1; string s2 = ""; getline(cin, s1); int l = s1.length(); bool flag = true; for (int i = 0; i < l; i++) { char c = s1.at(i); if(i < l-1 && c == 'd' && s1.at(i+1) == 'd') { s2 += 'p'; i++; } else if(i < l-1 && c == 'e' && s1.at(i+1) == 'i' && (i==0 || s1.at(i-1) != 'c')){ s2 += "ie"; i++; } else if(i < l-3 && c == 'p' && s1.at(i+1) == 'i' && s1.at(i+2) == 'n' && s1.at(i+3) == 'k'){ s2 += "floyd"; i += 3; } else if( i< l-2 && c== 'E' && s1.at(i+1) == 'O' && s1.at(i+2) == 'F'){ flag = false; break; } else if(c >= 'a' && c <= 'z' || c== ' ') s2 += c; } cout<<s2<<endl; if (flag == false) break; } return 0; }

你可能感兴趣的:(c,String,IE,include)