• + 9 comments
    from collections import defaultdict
    n=(int(input()))
    if 1<=n<=10**5: 
     
        d=defaultdict(int)
    
        for i in range(n):
            key=input()
            d[key] +=1
        print(len(d.keys())) 
        x=sorted(d.values())
        print(*x)
    

    wondering why only last 2 test case are ok, even when test case #0 is working fine even if tested against manual inputs. test case #0 is 100% as expected still showing failed.