-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringDecomposition.py
More file actions
55 lines (33 loc) · 916 Bytes
/
Copy pathStringDecomposition.py
File metadata and controls
55 lines (33 loc) · 916 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'''
Given a large string and a set of small strings, determine if it is possible to exactly
decompose the given large string into the set of small strings. (Assume that all the strings
are given in lowercase)
Input Format
The first line of the input contains a large string
The second line of the input contains space separated small strings
Output Format
Display Yes or No (no newline after the output)
Example:
Input:
abdefgbadklm
dab bad elmf kg
Output:
Yes
Input:
abdgefmnorst
frost badge lm
Output:
No
Explanation:
In the first case it is possible to construct the set of small strings by using exactly all the characters given in the original string.
In the second case it is not possible.
'''
s=input()
a=input().split()
b=""
for i in a:
b+=i
if(set(s)==set(b) and len(s)==len(b)):
print("Yes",end="")
else:
print("No",end="")