Company: Samsara Recruitment Test – IIT Delhi
Difficulty: medium
File Password Extraction Problem Description A password has been split across several files. Each file contributes exactly one character: the character that occurs most often in that file. When two or more characters occur the same (maximum) number of times, the file contributes the lexicographically smallest of them, that is the one with the smallest ASCII code. Read the files in the order they are given and concatenate their contributed characters to recover the password. Input Format The first line contains an integer n , the number of files. Each of the next n lines contains the content of one file: a non-empty string of printable ASCII characters in the range '!' (33) to '~' (126) (inferred -- the space character is excluded so that a password can never begin or end with whitespace, which the grader would strip). Output Format Print a single line containing the password: a string of exactly n characters, one taken from each file in order. Examples Example 1: Input: 3 hello world t