結果

問題 No.341 沈黙の期間
ユーザー h_tyokinuhata
提出日時 2016-02-14 21:47:05
言語 Java
(openjdk 23)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 448 bytes
コンパイル時間 2,005 ms
コンパイル使用メモリ 74,352 KB
実行使用メモリ 54,348 KB
最終ジャッジ日時 2024-09-22 06:40:35
合計ジャッジ時間 4,417 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String S = sc.next();
		
		char[] charS = S.toCharArray();
		
		int cnt = 0, max = 0;
		
		for(int i = 0; i < S.length(); i++) {
			if(charS[i] == '…') {
				cnt++;
			} else {
				if(cnt > max) {
					max = cnt;
				}
				
				cnt = 0;
			}
		}
		
		if(cnt > max) {
			max = cnt;
		}
		
		System.out.println(max);
	}
}
0