Most played song

Write codeEasy11 min

Your task

Given a non-empty play log, a list of song ids in the order they were played, return the id of the song with the highest total play count. If two or more songs tie for the highest count, return the alphabetically (lexicographically) smallest id among them, so the result is fully deterministic. For example, ["a", "b", "b", "a", "c", "b"] returns "b" (three plays), while ["c", "b", "c", "b", "a", "a"] returns "a" because all three songs tie at two plays each.

Examples

most_played(plays: list[str]) -> str
Example 1
Inputmost_played(["a", "b", "b", "a", "c", "b"])
Output"b"