#H2025a. Algorithm Memories
Algorithm Memories
Description
To perform better in the competition, you need to unlock your algorithm memories.
However, your memories are locked behind a password — a string of exactly lowercase letters.
You have tried a guess password, and the system returned a response string consisting of digits , or :
- means the letter does not appear in the correct password.
- means the letter exists in the correct password but not at this position.
- means the letter is correct and in the correct position.
Your task is to determine how many possible passwords are consistent with the guess and the response.
Format
Input
The first line contains a string with lowercase letters, the password you guessed.
The second line contains a string with digits, the response.
Output
One integer, the number of possible passwords.
Samples
maidx
20212
24
相关
在下列比赛中: