結果

問題 No.495 (^^*) Easy
ユーザー jimanojimano
提出日時 2018-01-27 16:43:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 709 bytes
コンパイル時間 3,020 ms
コンパイル使用メモリ 76,240 KB
実行使用メモリ 56,116 KB
最終ジャッジ日時 2023-08-28 09:55:18
合計ジャッジ時間 4,262 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
50,692 KB
testcase_01 AC 71 ms
50,564 KB
testcase_02 AC 70 ms
50,676 KB
testcase_03 AC 69 ms
50,556 KB
testcase_04 AC 76 ms
51,556 KB
testcase_05 AC 99 ms
53,644 KB
testcase_06 AC 121 ms
56,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package me.yukicoder.wip;

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

public class No0495_2 {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			String input = br.readLine();
			int cntLeft = 0;
			int cntRight = 0;
			String right = "(*^^)";
			String left = "(^^*)";

			for (int i = 0; i < input.length()- 5; i++) {
				if (input.substring(i, i + 5).equals(right)) {
					cntRight++;
				} else if (input.substring(i, i + 5).equals(left)) {
					cntLeft++;
				}
			}

			System.out.println(cntLeft + " " + cntRight);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0