import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
String special_char = "~`!@#$%^&*()-_=+\\|[{]};:'\",<.>/?";
char CC;
boolean numP = false;
boolean upper = false;
boolean lower = false;
boolean special = false;
System.out.print("Enter a string: ");
String input=in.next();
for (int i = 0; i < input.length(); i++) {
CC = input.charAt(i);
if (Character.isDigit(CC)) {
numP = true;
}
else if (Character.isUpperCase(CC)) {
upper = true;
}
else if (Character.isLowerCase(CC)) {
lower = true;
}
else if (special_char.contains(String.valueOf(CC))) {
special = true;
}
else{
System.out.print("Invalid login");
}
}
System.out.print("Valid login");
}
}
Comments
Leave a comment