結果
| 問題 | 
                            No.495 (^^*) Easy
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-01-27 16:43:23 | 
| 言語 | Java  (openjdk 23)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 146 ms / 2,000 ms | 
| コード長 | 709 bytes | 
| コンパイル時間 | 3,855 ms | 
| コンパイル使用メモリ | 75,040 KB | 
| 実行使用メモリ | 44,132 KB | 
| 最終ジャッジ日時 | 2024-12-29 06:49:12 | 
| 合計ジャッジ時間 | 4,721 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 7 | 
ソースコード
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();
		}
	}
}