Can someone explain how the input of example test case 2 is giving “YES”. I think it is violating rule 2 from the given conditions
The letter A-Z shoulb be inside doesn’t mean it can’t be outside .
The statement is poorly worded, but I’ll try to explain the misunderstanding.
What people are misunderstanding it as:
(There should be one or more upper case letters) AND (No upper case letter should be placed on the first or last spot)
What it was meant to mean:
(There should be one or more upper case letters in any position except the first or last)
Password must contain at least one upper case letter [A−Z] strictly inside, i.e. not as the first or the last character;
It’s mentioned that at least one … strictly inside, it’s not mentioned all of them should be strictly inside.
The easiest way to understand it is, the terminal characters should not be considered for checking condition 2.
I too had the same misunderstanding, but later the correct logic striked me!
Thanks! Got it.