[SOLVED]C#: Password Rules
Updated: Solved. See link for solution. I am having a difficult time figuring this out. It should be correct, but one of the hidden cases is failing and I don't know why. https://code.sololearn.com/ca34E9MTPFqi/?ref=app
12/30/2020 5:07:00 PMChris
9 AnswersNew Answer
TheWh¡teCat 🇧🇬 please disregard. I solved it. I was missing a break statement, so I figured out that the hidden case had multiple invalid symbols. I can label this as solved now. Updated code will be public for all to see.
Chris , in fact I didn't do anything. The second thing I was considering was that with many disallowed symbols it will print many times "Invalid".
That's exactly what was happening. I didn't realize this at first because the one failed case was hidden.
Chris , provide the full description of the task also exapmple inputs and outputs.
Write a program to take the password as input and output "Invalid", if it contains any disallowed symbols. If the password requirement is satisfied, program shouldn't output anything. Sample Input yl1893!dm$ Sample Output Invalid
I cannot tell you the case that is failing because it is hidden. C# 47.2 Practice
Chris , is it mentioned the full list of the symbols in the task? It's hard to compare them with this in your code.
Yes. The full list of symbols were the ones listed in my code. In any event, it is solved now. Thank you so much for taking a look, though!
cheers for this chris. i was struggling with this one myself. turns out my issue was i was trying to use the line if (password.Contains(notAllowedSymbols)) rather than if (password.Contains(i)) as in your example.