Most crashed device model

Write codeEasy10 min

Your task

A crash-reporting service stores one line per crash as "<device_model> <os_version>", for example "pixel8 14". Product wants to know which device model is generating the most crash reports. Given at least one line, return the model with the highest number of reports; if several models tie, return the alphabetically smallest model name. The OS version is irrelevant to the count, every line is one crash for its model.

Examples

crashiest_model(lines: list[str]) -> str
Example 1
Inputcrashiest_model(["pixel8 14", "iphone15 17", "pixel8 15"])
Output"pixel8"