/
Time Limit: 2 sec / Memory Limit: 1024 MiB
配点 : 233 点
問題文
高橋君は、学校の文化祭で応援メッセージボードを設置しました。
このボードでは、来場者が出演者への応援メッセージを書き込むことができます。高橋君は、文化祭の盛り上がりを分析するため、「元気な応援メッセージ」の数を数えたいと考えています。
「元気な応援メッセージ」とは、そのメッセージの文字列中に含まれる感嘆符 ! の個数が K 個以上であるメッセージのことを指します。
N 人の来場者がそれぞれ 1 つずつ応援メッセージを書き込みました。各来場者のメッセージは英小文字、英大文字、数字、および感嘆符からなる文字列として与えられます。「元気な応援メッセージ」がいくつあるかを求めてください。
制約
- 1 \leq N \leq 10^4
- 1 \leq K \leq 10^3
- 1 \leq |S_i| \leq 10^3(|S_i| は文字列 S_i の長さを表す)
- S_i は英小文字(
a〜z)、英大文字(A〜Z)、数字(0〜9)、および感嘆符(!)のみからなる(空白は含まれない) - N, K は整数
入力
N K S_1 S_2 \vdots S_N
1 行目には、来場者の人数を表す整数 N と、「元気な応援メッセージ」の基準となる感嘆符の個数を表す整数 K が、スペース区切りで与えられる。
続く N 行のうち i 行目(1 \leq i \leq N)には、i 番目の来場者のメッセージを表す文字列 S_i が 1 つ与えられる。
出力
「元気な応援メッセージ」の個数を 1 行で出力してください。
入力例 1
3 2 Hello! Great!!Work!! Nice
出力例 1
1
入力例 2
5 3 Ganbare!!! Good!Luck! Wonderful!!!!! Fight! BestWishes!!!YouCanDoIt!!!
出力例 2
3
入力例 3
8 4 Amazing!Performance! Bravo!!!! You!Are!The!Best! Super!!! Fantastic!!!!!!!! Keep!Going! Excellent!Work!Everyone!Cheers! WOW!!
出力例 3
4
Score : 233 pts
Problem Statement
Takahashi set up a cheer message board at his school's cultural festival.
On this board, visitors can write cheer messages for the performers. Takahashi wants to count the number of "energetic cheer messages" in order to analyze the excitement of the cultural festival.
An "energetic cheer message" is a message whose string contains K or more exclamation marks !.
N visitors each wrote exactly one cheer message. Each visitor's message is given as a string consisting of lowercase English letters, uppercase English letters, digits, and exclamation marks. Determine how many "energetic cheer messages" there are.
Constraints
- 1 \leq N \leq 10^4
- 1 \leq K \leq 10^3
- 1 \leq |S_i| \leq 10^3 (|S_i| denotes the length of string S_i)
- S_i consists only of lowercase English letters (
a–z), uppercase English letters (A–Z), digits (0–9), and exclamation marks (!) (no spaces are included) - N, K are integers
Input
N K S_1 S_2 \vdots S_N
The first line contains two integers separated by a space: N, the number of visitors, and K, the threshold number of exclamation marks for an "energetic cheer message".
For each of the following N lines, the i-th line (1 \leq i \leq N) contains a single string S_i representing the message of the i-th visitor.
Output
Print the number of "energetic cheer messages" on a single line.
Sample Input 1
3 2 Hello! Great!!Work!! Nice
Sample Output 1
1
Sample Input 2
5 3 Ganbare!!! Good!Luck! Wonderful!!!!! Fight! BestWishes!!!YouCanDoIt!!!
Sample Output 2
3
Sample Input 3
8 4 Amazing!Performance! Bravo!!!! You!Are!The!Best! Super!!! Fantastic!!!!!!!! Keep!Going! Excellent!Work!Everyone!Cheers! WOW!!
Sample Output 3
4