Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Немножко со строками, но работает же!)
- from collections import Counter
- n1 = input()
- n2 = input()
- n1_counts = Counter(n1)
- n2_counts = Counter(n2)
- result = True
- for k, v in n2_counts.items():
- if k not in n1_counts.keys():
- result = False
- break
- if v > n1_counts[k]:
- result = False
- break
- print(f"Из {n1} {'можно' if result else 'нельзя'} составить {n2}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement