fb pixel

Comparing sets

Video preview
Python allows to check if a set is a subset of another set. Set A is a subset of B if B contains all the elements of A and has some other elements as well. This can be done through a standard comparison operator:
a = {1, 3, 5, 7, 18}
b = {1, 7, 18}
if b <= a:
	print('B is a subset of A')
elif a <= b:
	print('A is a subset of B')
else:
	print('Not a subset!')
This will print B is a subset of A. A contains all the elements of B (1, 7, 18) and has some additional ones as well (3, 5).
To find the whole list of possible operations with Python sets visit their official page but these are the main operations that we will be focusing on.

Challenge

Given two lines of text, you are asked if those two lines contain the same set of symbols.
The input contains 2 lines of text.
The program should print Yes if they contain the same set of symbols and No otherwise.
Input
abcde
edcbaaa

Output
Yes
Input
abcde
edc

Output
No
 
To check your solution you need to sign in
Sign in to continue