s = input().strip() count = {} for c in s: count[c] = count.get(c, 0) + 1 sorted_items = sorted(count.items(), key=lambda x: (-x[1], 0 if x[0].islower() else 1, x[0])) output = ';'.join([f"{k}:{v}" for k, v in sorted_items]) + ';' print(output)