+ 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!!!🙃🙃🙃

21st Sep 2017, 1:36 PM
Kartik
Kartik - avatar
7 ответов
+ 4
One liner. Also tells you where the problem is. https://code.sololearn.com/cKL9u1yA4iJf/?ref=app
21st Sep 2017, 2:19 PM
VcC
VcC - avatar
1st Dec 2017, 4:21 PM
LukArToDo
LukArToDo - avatar
21st Sep 2017, 7:49 PM
sayan chandra
sayan chandra - avatar
+ 4
Not a challenge, but your homework @@
22nd Sep 2017, 12:53 PM
visph
visph - avatar
+ 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
23rd Sep 2017, 3:56 AM
David Ashton
David Ashton - avatar
+ 1
@visph It's a challenge, not my homework Solve it if you can and want to 😬
22nd Sep 2017, 12:57 PM
Kartik
Kartik - avatar
0
😁😀😊😉
22nd Sep 2017, 1:25 PM
sayan chandra
sayan chandra - avatar