DatabricksOA #19
Goto Largest Bucket
估计简单可在线判题
考点(AI 标注)哈希计数模拟/实现
Process the commands in order: goto name switches to that bucket (creating an empty bucket if it does not exist); create name creates a file with that name in the current bucket. File names within the same bucket are unique, so creating a duplicate does not increase the file count. Return the name of the bucket with the most files; a tie is guaranteed not to occur.
Standard input/output and this site's supplementary ranges follow this problem's description.
输入格式
The first line contains the number of commands q (2≤q≤50000), followed by q lines of commands. name is a single token of 1..40 ASCII letters, digits, underscores, or hyphens. The first command is goto, and there is at least one create.
输出格式
Output the name of the bucket with the unique maximum number of files.
样例 1
输入:
9
goto bucketA
create fileA
create fileB
create fileA
goto bucketB
goto bucketC
create fileA
create fileB
create fileC
输出:
bucketC
样例 2
输入:
7
goto a
create x
goto b
create x
create y
goto c
create z
输出:
b
样例 3
输入:
2
goto solo
create a
输出:
solo