×

# why do i get wrong answer in the following question (CLFIBD|python3.6)

 1 Question code: CLFIBD My code:for i in range(int(input())): str1=input() l=list(str1) s=set(l) l2=[] if len(s)<3: print("Dynamic") else: for x in s: a=l.count(x) l2.append(a) l2.sort() b=len(l2) ans=True for y in range(0,b-2): if l2[y]+l2[y+1]==l2[y+2]: ans=ans and True else: ans=ans and False if ans ==True: print ("Dynamic") else: print ("Not") asked 07 Nov '18, 19:31 2★v_shah 9●3 accept rate: 0%

 0 You need to take into account this case: abbcccdddd which is Dynamic under the permutation (b,a,c,d). answered 07 Nov '18, 20:00 5★joffan 948●8 accept rate: 13% Oh correct. Thanks a lot (08 Nov '18, 00:17) v_shah2★
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• image?![alt text](/path/img.jpg "title")
• numbered list: 1. Foo 2. Bar
• to add a line break simply add two spaces to where you would like the new line to be.
• basic HTML tags are also supported
• mathemetical formulas in Latex between \$ symbol

Question tags:

×421
×262
×19

question asked: 07 Nov '18, 19:31

question was seen: 85 times

last updated: 08 Nov '18, 00:17