結果

問題 No.725 木は明らかに森である
ユーザー N.MatsumotoN.Matsumoto
提出日時 2019-09-21 21:54:53
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 746 bytes
コンパイル時間 2,274 ms
コンパイル使用メモリ 74,912 KB
実行使用メモリ 57,652 KB
最終ジャッジ日時 2023-10-19 06:49:29
合計ジャッジ時間 4,195 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
57,288 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 134 ms
57,652 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] array = sc.next().split("");

        List<String> res = new ArrayList<>();
        List<String> target = new ArrayList<>();
        for (String str : array) {
            target.add(str);
            if (target.size() == 7) {
                if (String.join("", target).equals("treeone")) {
                    res.add("forest");
                } else {
                    res.add(String.join("", target));
                }
                target.clear();
            }
        }
        System.out.println(String.join("", res));
    }
}
0