結果
| 問題 | 
                            No.725 木は明らかに森である
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-08-28 23:51:58 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 652 bytes | 
| コンパイル時間 | 422 ms | 
| コンパイル使用メモリ | 56,296 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-18 11:44:57 | 
| 合計ジャッジ時間 | 992 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 3 WA * 4 RE * 2 | 
ソースコード
#include <iostream>
#include <string>
using namespace std;
string replaceOtherStr(string &replacedStr, string from, string to) {
    const unsigned int pos = replacedStr.find(from);
    const int len = from.length();
 
    if (pos == std::string::npos || from.empty()) {
        return replacedStr;
    }
 
    return replacedStr.replace(pos, len, to);
}
int main(){
    string s;
    cin >> s;
    bool flg = 0;
    for(int i = 0; i < s.length() - 7; i++){
        if(s.compare(i, 7, "treeone") == 0){
            flg = 1;
            break;
        }
    }
    if(flg) replaceOtherStr(s, "treeone", "forest");
    cout << s << endl;
    return 0;
}