[SOLVED]C#: Password Rules | Sololearn: Learn to code for FREE!

+3

[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 PM

Chris

9 Answers

New Answer

+1

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.

+1

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".

+1

That's exactly what was happening. I didn't realize this at first because the one failed case was hidden.

0

Chris , provide the full description of the task also exapmple inputs and outputs.

0

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

0

I cannot tell you the case that is failing because it is hidden. C# 47.2 Practice

0

Chris , is it mentioned the full list of the symbols in the task? It's hard to compare them with this in your code.

0

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!

0

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.