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

11015번 - Spring 2005: Arriving at USC 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB130696158.095%

문제

For the very first contest, in Spring of 2005, we explored a few things around USC, calling it simply “The USC Contest”. One of the things we explored was the use of building name abbreviations such as SAL, PHE, OHE, or SSL. The students back then — and you now — were asked to write a program to return all the candidate building names that an abbreviation could refer to.

You will be given a list of building names, and a building abbreviation, such as SAL or LOL. The abbreviation matches a building name if all of its letters appear, in this order, in the building name (no letter can be matched twice). So, for instance, SAL matches “SALvatori” or “Student Aerospace Laboratory”, or “univerSity of southern cALifornia”. It does not match “angeles”, as the letters are in the wrong order. For the comparison, we will ignore case, so ‘S’ and ‘s’ are the same letter.1

1We only used capitalization above to show you the match.

입력

The first line is the number K of input data sets, followed by the K data sets, each of the following form:

The first line of the data set contains the number n of buildings, 1 ≤ n ≤ 100. This is followed by n lines, each containing the name of a building, consisting of only uppercase and lowercase letters and white space. Finally, the building code will follow on a line by itself, consisting only of letters. Each string will be at most 100,000 characters long.

출력

For each data set, output “Data Set x:” on a line by itself, where x is its number.

Then output all of the building names that match the building code, each on its own line, and in the order in which they appeared in the initial list.

Each data set should be followed by a blank line.

제한

예제 입력 1

2
3
studENt aeRoSpace laBoratory
salVAtori
angeles
SAL
2
SaLvatori
Science LibrarieS
SSL

예제 출력 1

Data Set 1:
studENt aeRoSpace laBoratory
salVAtori
Data Set 2:

힌트

출처

University > The USC Programming Contest > Spring 2015: Anniversary A번

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

출처

대학교 대회

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

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