/**
import re
m=int(input())
for j in range(m):
password=str(input())
flag=1
while True:
if (len(password)<10):
flag = -1
break
elif not re.search(“[a-z]”, password[0]):
flag = -1
break
elif not re.search(“[a-z]”, password[-1]):
flag = -1
break
elif not re.search(“[a-z]”, password):
flag = -1
break
elif not re.search(“[A-Z]”, password[1:len(password)-1]):
flag = -1
break
elif not re.search(“[0-9]”, password[1:len(password)-1]):
flag = -1
break
elif not re.search(“[@#%&?]”, password[1:len(password)-1]):
flag = -1
break
else:
flag = 0
print(“YES”)
break
No,it says that there should be atleast one upper case letter[A-Z] which is strictly inside. It can be on first and last but should also be inside too.
i think the test cases that is already there are incorrect .
like for U@code4CHEFINA this test case they said it’s valid pass . and according to condition no.2 that is " Password must contain at least one upper case letter [A−Z] strictly inside, i.e. not as the first or the last character;" we should print “no” then how they said it’s valid pass. becoz at first pos there is U and A on the last . please help me out with this
Bro, test cases are correct. The question says that password must contain atleast one upper case letters which is inside. It doesnt mean that upper case letters cant be on first or last, they can be but atleast one should be inside.
Bro! It’s not mentioned anywhere that the first & last digits of the string input have to be a lowercase character. Also, the explanation regarding strictly inside was not so lucid, however, it can be solved easily using regex. You can check my solution below:
import re
for T in range(int(input().strip())):
S=input()
S1=S[1:-1]
if (len(S)>=10):
x=re.findall(“[0-9]”, S1)
y=re.findall(“[A-Z]”, S1)
z=re.findall(“[@,#,%,?,&]”, S1)
w=re.findall(“[a-z]”, S)
if x and y and z and w:
print(“YES”)
else:
print(“NO”)
else:
print(“NO”)