Under construction

Still being built. Things may change

Democratic Naming

Interview

Time limit1sMemory limit1024 MB

Summary
Given n city names of length m, build the county name by picking, for each position, the letter most cities have there, breaking ties alphabetically.
Level

Easy2 of 10

Topics
Array, Hash map, Implementation
Solved
No attempts yet

Problem

The county was created on artificially made land off the coast, with the code name "Built Anew Peninsula County", but its final name still needs to be chosen. The cities in the county vote on the individual letters of the name.

All cities in the county have a name with exactly mm letters, so the county name also has exactly mm letters. Each city prefers its own name, so it votes that the iith letter of the county name matches its own iith letter. For each of the mm positions, the letter with the most votes is picked. If several letters tie, the one earliest in the English alphabet is picked.

Given the city names, determine the result of the vote for the county name.

Input

The first line has two integers nn and mm (1≤n≤10001\leq n\leq 1000, 1≤m≤10001 \leq m \leq 1000), the number of cities and the number of letters in each city name.

Each of the next nn lines has a string of length mm, the name of a city. The names consist only of lowercase English letters (a-z).

Output

Output the name of the new county.

Examples2

  1. Example 1

    Input
    3 5
    apple
    maple
    alpha
    
    Expected output
    aaple
    
  2. Example 2

    Input
    3 4
    icpc
    back
    laps
    
    Expected output
    bapc