結果

問題 No.423 ハムスター語初級(数詞)
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-17 17:21:27
言語 Java21
(openjdk 21)
結果
AC  
実行時間 108 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 2,379 ms
コンパイル使用メモリ 73,348 KB
実行使用メモリ 57,248 KB
最終ジャッジ日時 2023-09-06 17:49:36
合計ジャッジ時間 3,520 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
55,668 KB
testcase_01 AC 104 ms
55,668 KB
testcase_02 AC 106 ms
55,324 KB
testcase_03 AC 106 ms
55,532 KB
testcase_04 AC 104 ms
55,856 KB
testcase_05 AC 105 ms
56,020 KB
testcase_06 AC 103 ms
54,044 KB
testcase_07 AC 100 ms
57,248 KB
testcase_08 AC 103 ms
55,332 KB
testcase_09 AC 103 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		String s = sc.next();
		s = s.replace("hamu","1");
		s = s.replace("ham","0");
		s = s + "0";
		s = s.replace("1","hamu");
		s = s.replace("0","ham");
		System.out.println(s.equals("hamham")==false?s:"ham");
	}
}
0