We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Python
- Collections
- Word Order
- Discussions
Word Order
Word Order
Sort by
recency
|
1666 Discussions
|
Please Login in order to post a comment
Simple method using Counter
from collections import Counter
n = int(input()) strs=Counter() for _ in range(n): arr=input() strs[arr]+=1 print(len(strs)) print(*strs.values())
Simple solution without counter, just dict
cool solution using Counter