|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||7||7||7||100.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.
6 12 CAD ADD ALE DALE PAT ICPC
4 15 KEK LMAO LEL LOL