+ 1

Why does my solution to "Security" code coach not work?

In this code, https://code.sololearn.com/cj0iE2wtNkky/?ref=app I used regex to match the casino layout. For some reason when I try to run this code, all tests are successful EXCEPT last test. I can't find a layout where my regex would not work. Can someone help me?

11th Jul 2022, 7:43 AM
Super Ant
Super Ant - avatar
5 Answers
+ 1
Ex: $xGxGxGxT failing.. Your checking G in between $, T atleast one. and actually there may be $xGxGxGxGT like patterns, which may fail. Because there is no sure pattern.. First remove x, then your way works simply for any case
11th Jul 2022, 12:29 PM
Jayakrishna 🇼🇳
+ 1
Hmm, I changed pattern a little bit, now it has to work, and it works in all case tests, even the last one, but the fourth case test does not work. What did I do wrong now?
11th Jul 2022, 12:55 PM
Super Ant
Super Ant - avatar
+ 1
Ex: $xTxG failing [Gx]+ means 'G' Or 'x' at least ones..
11th Jul 2022, 1:16 PM
Jayakrishna 🇼🇳
+ 1
I sat thinking for an hour and I finally made it work! Thanks for finding failing prompts
11th Jul 2022, 3:22 PM
Super Ant
Super Ant - avatar
0
I think you can simplify it by just first remove x from input string (as x as no special value) then use your previous first regex. You're welcome..
11th Jul 2022, 6:25 PM
Jayakrishna 🇼🇳