WC 7.1 13 Reasons to Save Hannah

Hannah has been given a string consisting of alphabets and digits, she needs to decode it correctly to save herself, help her decode it. To decode the string, you have to find the frequency of each digit in the given string then, find the sum of all those frequencies. If the sum is equal to ‘13’ print “Hannah survived” else print “Hannah did not survive”.

Input Format:-
The first line contains a string S.
1 All the elements of S are made of English alphabets and digits.
Where, num is the input string.

Output Format:-
Find the sum of the ten space-separated integers denoting the frequency of each digit from 0 to 9. If the sum of the frequencies is 13, print “Hannah survived” else print “Hannah did not survive”.

Sample Input 0
Sample Output 0
Hannah did not survive
Explanation 0
0 + 2 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 = 7
In the given string:
• 1 occurs two times.
• 2, 4, 5, 6 and 7 occur one time each.
• The remaining digits and don’t occur at all.

Testcases: link

This challenge is worth 60 points.

You must be logged in to submit a solution

View ranklist for this challenge
About scoring and submission

Contact Us

Kunal Desai : 7715051136

Neelraj Patil : 9930671144

Privacy Policy