In the Byteland country a string "S" is said to super ascii string if and only if count of each character in the string is equal to its ascii value.
In the Byteland country ascii code of 'a' is 1, 'b' is 2 ...'z' is 26.
Your task is to find out whether the given string is a super ascii string or not.
Ans in python: S=input () L=[] for i in range(0,26): L.append(i)
L[i]=0 for i in range(0,len(s)): K= ord(s[i]-97 L[k]=l[k]+1 for i in
range(0,26): C=0 if (l[i]==i+1 or l[i]==0): C=1 else: C=0 break
if(c!=0): print("yes") else: print("no")
Leave a comment
Thank you! Your comments have been successfully added. However, they need to be checked by the moderator before being published.
Comments
Ans in python: S=input () L=[] for i in range(0,26): L.append(i) L[i]=0 for i in range(0,len(s)): K= ord(s[i]-97 L[k]=l[k]+1 for i in range(0,26): C=0 if (l[i]==i+1 or l[i]==0): C=1 else: C=0 break if(c!=0): print("yes") else: print("no")
Leave a comment