#K5291. Unique Number Permutations
Unique Number Permutations
Unique Number Permutations
Given a numeric string s
, each occurrence of the digit '6' or '9' can be independently considered as either '6' or '9'. Therefore, if there are n occurrences of these digits, there exist $$2^{n}$$ unique numbers that can be formed. Your task is to compute this value for each given input string.
For example, if s = "69"
then the count is $$2^2 = 4$$ unique numbers, as both digits can be flipped independently.
inputFormat
The input begins with an integer T
on the first line, representing the number of test cases. Each of the following T
lines contains a string s
which represents a number.
outputFormat
For each test case, output an integer on a new line representing the count of unique numbers that can be generated by independently flipping each '6' and '9' in the string.
## sample3
69
96
123
4
4
1
</p>