結果

問題 No.203 ゴールデン・ウィーク(1)
ユーザー omc-test
提出日時 2016-12-14 15:58:50
言語 Java
(openjdk 23)
結果
AC  
実行時間 58 ms / 1,000 ms
コード長 827 bytes
コンパイル時間 3,587 ms
コンパイル使用メモリ 76,872 KB
実行使用メモリ 50,456 KB
最終ジャッジ日時 2024-11-18 09:57:24
合計ジャッジ時間 6,102 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class No0203 {

	public static void main(String[] args){
		try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))){
			char c1[] = br.readLine().toCharArray();
			char c2[] = br.readLine().toCharArray();
			int ans = Counter(c1, c2);
			System.out.println(ans);

		}catch(IOException e){
			e.printStackTrace();
		}
	}

	public static int Counter(char c1[], char c2[]){
		int ans = 0;
		int buf = 0;

		for(int i=0; i<c1.length; i++){
			if(c1[i] == 'o'){
				buf++;
			}else{
				ans = Math.max(buf, ans);
				buf = 0;
			}
		}
		for(int i=0; i<c2.length; i++){
			if(c2[i] == 'o'){
				buf++;
			}else{
				ans = Math.max(buf, ans);
				buf = 0;
			}
		}
		ans = Math.max(buf, ans);

		return ans;
	}
}
0