import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static int minimumNumber(int n, String password) { // Return the minimum number of characters to make the password strong boolean valid = true; if (password.length() < 6) { String upperCaseChars = "(.*[A-Z].*)"; else if (!password.matches(upperCaseChars )) { System.out.println("Password should contain atleast one upper case alphabet"); valid = false; } String lowerCaseChars = "(.*[a-z].*)"; else if (!password.matches(lowerCaseChars )) { System.out.println("Password should contain atleast one lower case alphabet"); valid = false; } String numbers = "(.*[0-9].*)"; else if (!password.matches(numbers )) { System.out.println("Password should contain atleast one number."); valid = false; } String specialChars = "(.*[,~,!,@,#,$,%,^,&,*,(,),-,_,=,+,[,{,],},|,;,:,<,>,/,?].*$)"; else if (!password.matches(specialChars )) { System.out.println("Password should contain atleast one special character"); valid = false; } else { System.out.println("Password has number,specialchar,lowerchar and also upperchar but size is small"); } } else if(password.length()>6) { if(!password.matches(numbers) && !password.matches(specialChars) && !password.matches(lowerCaseChars) && !password.matches(upperCaseChars)) { System.out.println("Password should contain atleast one number,lowercasechar,uppercasechar or specialchar"); valid = false; } else { System.out.println("Password is strong"); } } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); String password = in.next(); int answer = minimumNumber(n, password); System.out.println(answer); in.close(); } }