Logo
(追記) (追記ここまで)

18813번 - Divisionals Spelling 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB33824821973.000%

문제

Emilio’s team is competing at the South Pacific ICPC Divisional Finals. They have read the problems and immediately know all the solutions. Emilio finds simply winning the contest boring. Instead, he has convinced his team to spell out a word with their submissions. He has put together a list of n words that he would like to spell.

Each question in the contest is labelled with an uppercase letter. The first question is labelled “A”, the second is labelled “B”, and so on. A word is spelled by solving questions in a specific order. For example, if Emilio’s team wants to spell LEAK, the team first solves problem L, then problem E, then problem A, and finally problem K. The team may only solve each problem once, so they may not spell words with duplicated letters (for example, they cannot spell EMILIO). Which words can Emilio’s team spell?

입력

The first line contains two integers n (1 ≤ n ≤ 100), which is the number of words in Emilio’s list, and m (1 ≤ m ≤ 15), which is the number of questions in the contest.

The next n lines describe the words. Each of these lines contains a word with at least 1 and at most 15 uppercase letters. All the words are distinct.

출력

Display the number of words in the list that can be spelled.

제한

예제 입력 1

6 12
CAD
ADD
ALE
DALE
PAT
ICPC

예제 출력 1

3

예제 입력 2

4 15
KEK
LMAO
LEL
LOL

예제 출력 2

1

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > 2019 ICPC South Pacific Regionals D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /