RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
COCI00366

Marko

Unrated 레이팅 미적용
난이도
2s
시간 제한
64MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

\(2^{th}\) round, November \(7^{th}\) 2015
Good old Marko came across a new feature on his mobile phone – T9 input! His phone has a keyboard
consisting of numbers looking like this:
1
2
abc
3
def
4
ghi
5
jkl
6
mno
7
pqrs
8
tuv
9
wxyz
In order to input a word using this keyboard, one needs to press a key multiple times for the required
letter. More specifically, if the required letter is the first letter mapped to the key, one key press is
needed, if it’s the second, two key presses are needed and so on. For instance, if we want to input the
word “giht”, we will press the following keys: \(g-4\) \(i-444\) \(h-44\) \(t-8\). The new possibility Marko discovered
enables you to input text more easily because you don’t need several presses per letter anymore,
just one. The software will try to figure out what word from the dictionary you are trying to input.
Marko is quite sceptical of new technologies (at least new for him) and he is afraid that errors will be
frequent. That is the reason why he decided to test his hypothesis that the errors are frequent. Marko
knows by heart the whole dictionary in the mobile phone. The dictionary consists of \(N\) words consisting
of lowercase letters from the English alphabet, the total length of the word not exceeding1 000 000
characters. He will give an array of key presses \(S\), of total length at most 1 000, and wants to know
how many words from the dictionary can be mapped to the given array of key presses if the T9 input
feature is used.

제약
입력 형식

The first line of input contains the integer \(N\), the number of words in the dictionary. (1 ⩽\(N\) ⩽1 000).
Each of the following \(N\) lines contains a single word. The last line of input contains the string \(S\)
(1 ⩽|\(S\)| ⩽1000) consisting of digits \(2-9\).

출력 형식

The first and only line of output must contain the number of words from the dictionary possible to
construct from the letters on the keys determined by the string \(S\).

예제 1
입력
3
tomo
mono
dak
6666
2
ja
la
52
3
dom
fon
tom
366
출력
output
output
1
2
2
설명

Clarification of the first example: “mono” is the only word that has all the letters located on key 6..
Clarification of the second example: The first letter of both words is located on key 5 and the second letter
of both words is located on key 2.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2015/2016 Contest 2

평가 및 의견

Marko

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Marko

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8