+ 1

What is wrong with this program?

I tried to solve this program in code coach today.at last I got one mistake 8th.i dont know what is that? Pls vlear me. https://code.sololearn.com/c5BVTID0cvsA/?ref=app

7th Mar 2021, 1:45 PM
Jawahirullah
Jawahirullah - avatar
3 Answers
+ 1
For input : abcde12 No special characters, its failing.. it should output "Weak" Edit: for single case, i checked according to your description...
7th Mar 2021, 1:53 PM
Jayakrishna 🇼🇳
+ 1
You need to initialize your counter variables, otherwise it is not guaranteed their value will be 0, i.e. int num{}; int sum{}; int len{}; Also, it is not necessary to break from the loop if a character does not match any character that would contribute towards one of the counters, although this has no influence on the result of the test cases.
7th Mar 2021, 1:56 PM
Shadow
Shadow - avatar
+ 1
Thank you shadow
7th Mar 2021, 2:03 PM
Jawahirullah
Jawahirullah - avatar