← 返回 sofi 的题目列表Find second most frequent tag
类型:online_judge
Given a list of tags, find the tag that appears the second most frequently. If the second and third most frequent tags have the same count, return an empty string. Implement the function def find_second_most_frequent_tag(tags: List[str]) -> str: to achieve this.
Example:
Input: ['tag1', 'tag2', 'tag1', 'tag3', 'tag2', 'tag2']
Output: 'tag1'
Input: ['tag1', 'tag2', 'tag1', 'tag3', 'tag2', 'tag3']
Output: ''
You should return the tag based on the rules above.
Example
Input
['tag1', 'tag2', 'tag1', 'tag3', 'tag2', 'tag2']