Can someone explain why my test cases are failing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

Can someone explain why my test cases are failing?

Here is the problem.. https://www.codechef.com/COOK126C/problems/PASSWD And here's my attempt https://code.sololearn.com/cniLL3pYTYET/?ref=app

24th Jan 2021, 4:34 PM
Aditya
Aditya - avatar
7 Answers
+ 7
Yes it runs on individual trials but when I run with 3 test cases..it fails like Test cases 3 #cookOff#P1 U@code4CHEFINA gR3@tPWD --this case is failing My Output No Yes Yes Expected Output No Yes No
24th Jan 2021, 5:31 PM
Aditya
Aditya - avatar
+ 7
I appreciate your help! But something isn't working as per the constraints idk though..
25th Jan 2021, 11:53 AM
Aditya
Aditya - avatar
+ 6
No bro.. you are changing the results..and that's not I'm looking for.. Thanks anyways
24th Jan 2021, 6:32 PM
Aditya
Aditya - avatar
+ 5
what the problem with your code? it prints 'No' for 'gR3@tPWD' which is correct. on the codechef page it's said that you have to print 'YES' or 'NO'.
24th Jan 2021, 5:25 PM
John Robotane
John Robotane - avatar
+ 3
add on line 6 sc.nextLine(); this will consume the residual '\n' produced by h=sc.nextInt; and your regex are not correct, they match even invalid password.
24th Jan 2021, 5:59 PM
John Robotane
John Robotane - avatar
24th Jan 2021, 6:24 PM
John Robotane
John Robotane - avatar
+ 1
I read the description on the codechef page, it's said there that a valid password should not start or end with a capital letter. so I think there is an error in the execution example they gave, concerning 'U@code4CHEFINA' which should not be valid. if you want to ignore this condition, just remove the line 27 of my code.
24th Jan 2021, 6:39 PM
John Robotane
John Robotane - avatar