結果

問題 No.430 文字列検索
ユーザー htensai
提出日時 2019-11-19 21:01:05
言語 Java
(openjdk 23)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 413 bytes
コンパイル時間 1,827 ms
コンパイル使用メモリ 73,968 KB
実行使用メモリ 46,232 KB
最終ジャッジ日時 2024-11-10 00:37:32
合計ジャッジ時間 14,006 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13 TLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		String target = sc.next();
		int m = sc.nextInt();
		int count = 0;
		for (int i = 0; i < m; i++) {
		    String test = sc.next();
		    int idx = 0;
		    while ((idx = target.indexOf(test, idx)) != -1) {
		        idx++;
		        count++;
		    }
		}
		System.out.println(count);
	}
}
0