0
Password Validation
Hey guys, i've just tried to solve the task with the simpliest way possible (not the shortest), and it seems right to me, but shows a mistake in 1 case from 13🤷♂️ I've also tried to look through other requests here, but havent found exactly my situation as soon as other dudes used regex(not my level yet).Please help me to find a mistake or give a direction to think! Here's my code: https://www.sololearn.com/coach/76?ref=app
3 Antworten
+ 3
You forgot that the password must also have 2 numbers in it to be Strong
0
Ouch, i used a wrong link, here's the code instead:
static void Main(string[] args)
{
string a=Console.ReadLine();
int c=0;//thats the counter for symbols
char [] b ={'!', '@', '#', '#x27;, '%', '&', '*'};
for(int i=0;i<a.Length;i++)
{
for (int j=0;j<b.Length;j++)
{
if (a[i]==b[j])
{
c++;
}
}
}
if (c>=2 && a.Length>=7)
{
Console.WriteLine("Strong");
}
else
{
Console.WriteLine("Weak");
}
}
}
}
0
Thanks, dunno why i missed this one. Thanks a lot!