-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb.py
More file actions
52 lines (45 loc) · 1.09 KB
/
b.py
File metadata and controls
52 lines (45 loc) · 1.09 KB
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
# def list_to_number(lis):
# sum = 0
# n = len(lis)
# for i in range(n):
# sum += lis[i] * 2**(n-i-1)
# return sum
def if_subsequence_present(binary_no, target):
m= len(binary_no)
n= len(target)
i=0
if n==m:
if binary_no==target:
return True
else:
return False
checker=0
for x in range(m):
if binary_no[x] == target[i]:
i+=1
if i==n:
return True
return False
def generatePrintBinary(n):
from queue import Queue
q = Queue()
for i in range(97, 123):
q.put(chr(i))
while(n > 0):
n -= 1
s1 = q.get()
arr.append(s1)
for i in range(97, 123):
s2 = s1
q.put(s2+chr(i))
n=4
arr=[]
# list_to_number([1, 0, 1, 0, 0, 1])
arr.append("a")
generatePrintBinary(n)
for _ in range(int(input())):
word=input()
for __ in range(len(arr)):
if not if_subsequence_present(word, arr[__]):
print(arr[__])
break