Advertisement
JeffGrigg

Untitled

Jan 8th, 2018
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.68 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Solution {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         int numberOfPasswords = scanner.nextInt();
  8.         scanner.nextLine();
  9.         String password ;
  10.         for (int i =0 ;i < numberOfPasswords;i++){
  11.             password = scanner.nextLine();
  12.             int m = countOptions(password);
  13.             System.out.println(m);
  14.         }
  15.     }
  16.  
  17.     protected static int countOptions(String password) {
  18.         String [] s = password.split("\\+");
  19.  
  20.         int m=1;
  21.         for (int j = 1 ; j<s.length ;j++){
  22.             m=m*s[j].length();
  23.         }
  24.         return m;
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement