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

30492번 - Democratic Naming 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB15712711383.088%

문제

A new county has been created on artificially created land out from the coast, with code name "Built Anew Peninsula County", but the final name still needs to be chosen. To establish a new name, the cities within the county get to vote on the individual letters of the name.

As it happens, all cities in the county have a name with exactly $m$ letters, and so they decide the name of the county will also have exactly $m$ letters. Naturally, each city prefers their own name, and thus votes that the $i$th letter of the county name should match theirs. For each of the $m$ positions, the letter that received the most votes across all cities gets picked. In case of a tie between multiple letters, the one occurring earliest in the English alphabet gets picked.

Given the list of the city names, determine the result of the vote for the new county's name.

입력

The input consists of:

  • One line with two integers $n$ and $m$ (1ドル\leq n\leq 1000,ドル 1ドル \leq m \leq 1000$), the number of cities and the number of letters in each city name.
  • $n$ lines, each with a string of length $m,ドル the name of a city.

The city names only consist of lowercase English letters (a-z).

출력

Output the name of the new county.

제한

예제 입력 1

3 5
apple
maple
alpha

예제 출력 1

aaple

예제 입력 2

3 4
icpc
back
laps

예제 출력 2

bapc

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2023 D번

  • 문제를 만든 사람: Ivan Fever
(追記) (追記ここまで)

출처

대학교 대회

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

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