結果

問題 No.418 ミンミンゼミ
ユーザー orihadek
提出日時 2017-12-12 17:52:01
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 935 bytes
コンパイル時間 3,718 ms
コンパイル使用メモリ 76,616 KB
実行使用メモリ 56,204 KB
最終ジャッジ日時 2024-12-14 06:08:01
合計ジャッジ時間 8,090 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class no2 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int n = s.length();
        int st1 = 0;
        int st2 = 0;
        int count = 0;
        for(int j = 0;j < n;j++){
            char c = s.charAt(j);
            if(st1==0 && st2 ==0){
                if(c=='m') {
                    st1 = 1;
                }
            }else if(st1==1 && st2==0){
                if(c=='i') {
                    st2 = 1;
                    st1 = 0; 
                }else{
                    st1=0;
                }
            }else if(st1==0 && st2==1){
                if(c=='-'){}
                else if(c=='n'){
                    count +=1;
                    st2 = 0;
                }else{
                    st2 = 0;
                }
            }
            System.out.print(count);
        }
    }

}
0