Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Solution {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int numberOfPasswords = scanner.nextInt();
- scanner.nextLine();
- String password ;
- for (int i =0 ;i < numberOfPasswords;i++){
- password = scanner.nextLine();
- int m = countOptions(password);
- System.out.println(m);
- }
- }
- protected static int countOptions(String password) {
- String [] s = password.split("\\+");
- int m=1;
- for (int j = 1 ; j<s.length ;j++){
- m=m*s[j].length();
- }
- return m;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement