+ 4
CHALLENGE: Alphabets in the right proportion
Input a string in lower-case If 'a' occurs 0 or 1 time, 'b' occurs 0 or 2 times, 'c' occurs 0 or 3 times, ...... and 'z' occurs 0 or 26 times, then print 'Yes' Else print 'No' Input: A string in lower-case Output: Yes or No Example: Input: abbccc Output: Yes as a occurs once, b occurs twice and c occurs thrice, rest 0 times Input: aabccc Output: No as a occurs twice which should have been once All the best!!!đđđ
7 Answers
+ 4
One liner. Also tells you where the problem is.
https://code.sololearn.com/cKL9u1yA4iJf/?ref=app
+ 9
+ 5
đđđđđ....
https://code.sololearn.com/ccBGPi6AiA1F/?ref=app
+ 4
Not a challenge, but your homework @@
+ 3
string = input()
yes = all(string.count(letter) == ord(letter) - 96 for letter in string)
print("{}".format("Yes" if yes else "No"))
https://code.sololearn.com/cS3V5KuN5r51/#py
+ 1
@visph
It's a challenge, not my homework
Solve it if you can and want to đŹ
0
đđđđ