-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfibonacciString.py
More file actions
41 lines (39 loc) · 952 Bytes
/
Copy pathfibonacciString.py
File metadata and controls
41 lines (39 loc) · 952 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
#data handling
n = int(input())
strings = []
for i in range(n):
inputs = input()
strings.append(inputs)
# print(strings)
# logic
def fibbonaci(a, b, c):
if (a==b+c) or (b == a+b) or (c == a+b):
return True
else:
return False
for string in strings:
completed = []
last = len(string)
count = [0] * last
k = 0
for i in range(last):
if string[i] in completed:
continue
else:
completed.append(string[i])
for j in range(i,last):
if string[i] == string[j]:
count[k]+=1
k +=1
test = False
constraint = len(completed)
if constraint >= 3 :
for i in range(2, constraint):
test = fibbonaci(count[i], count[i-1],count[i-2])
if test:
print("Dynamic")
break;
if not test:
print("Not")
else:
print("Not")