結果
| 問題 | 
                            No.725 木は明らかに森である
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-09-20 20:55:43 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 553 bytes | 
| コンパイル時間 | 484 ms | 
| コンパイル使用メモリ | 66,012 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-18 08:36:41 | 
| 合計ジャッジ時間 | 915 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 8 WA * 1 | 
ソースコード
#include<iostream>
#include<string>
using namespace std;
int main() {
	//文字列からtreeoneの最初の位置を検索する
	//treeoneを取り除く
	//取り除いた位置にforestを挿入する
	//これをくりかえす
	string str, forest = "forest",treeone="treeone";
	string substr;
	cin >> str;
	int start = 0;
	while (true) {
		int index = str.find(treeone, start);
		if (index == -1)break;
		str.erase(index, treeone.size());
		str.insert(index, forest);
		start = index + forest.size()-1;
	}
	cout << str << endl;
	return 0;
}