結果

問題 No.536 人工知能
ユーザー jimanojimano
提出日時 2018-01-26 22:25:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 53 ms / 1,000 ms
コード長 641 bytes
コンパイル時間 3,473 ms
コンパイル使用メモリ 72,484 KB
実行使用メモリ 49,876 KB
最終ジャッジ日時 2023-08-27 19:19:19
合計ジャッジ時間 4,852 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
49,816 KB
testcase_01 AC 51 ms
49,612 KB
testcase_02 AC 51 ms
49,624 KB
testcase_03 AC 52 ms
49,760 KB
testcase_04 AC 53 ms
49,752 KB
testcase_05 AC 53 ms
49,612 KB
testcase_06 AC 53 ms
49,740 KB
testcase_07 AC 52 ms
49,876 KB
testcase_08 AC 52 ms
49,628 KB
testcase_09 AC 52 ms
49,820 KB
testcase_10 AC 52 ms
49,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class No0536 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String input = br.readLine();

			String ans = judgeLastletter(input) ? input.substring(0, input.lastIndexOf("ai")) + "AI" : input + "-AI";

			System.out.println(ans);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	static boolean judgeLastletter(String input) {
		return input.charAt(input.length() - 2) == 'a' && input.charAt(input.length() - 1) == 'i';
	}
}
0