結果
問題 |
No.725 木は明らかに森である
|
ユーザー |
![]() |
提出日時 | 2019-02-03 12:57:53 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 785 bytes |
コンパイル時間 | 1,263 ms |
コンパイル使用メモリ | 159,964 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-16 07:09:58 |
合計ジャッジ時間 | 1,858 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; // How to replace all occurrences of a character in string?. // https://stackoverflow.com/questions/2896600/how-to-replace-all-occurrences-of-a-character-in-string string replaceAll(string str, const string& from, const string& to) { size_t start_pos = 0; while((start_pos = str.find(from, start_pos)) != string::npos) { str.replace(start_pos, from.length(), to); start_pos += to.length(); // Handles case where 'to' is a substring of 'from' } return str; } int main() { // 1. 入力情報取得. string ans; cin >> ans; // 2. i文字目, j文字目入れ替え. ans = replaceAll(ans, "treeone", "forest"); // 3. 出力. cout << ans << endl; return 0; }