You are given an integer \(N\).
A pair \((x,y)\) is considered good if \(x\) is odd and \(y\) is even.
Task
Your task is to count the number of good pairs among N's digits.
Note:
- You have to count duplicate pairs forming as well. View the sample explanation section for more clarification.
Example
Assumption:
\(N\) = 1224
Approach:
The odd numbers amongst N's digits are [1] and even digits are [2,2,4]. The total pairs that can be formed are (1,2), (1,2) and (1,4). Thus, the answer is 3.
Function description
Complete the function solve provided in the editor. This function takes the following one parameter and returns the required answer:
\(N\): the integer amongst whose digits you have to count the good pairs.
Input format
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button).
The first line contains \(T\) denoting the number of test cases. \(T\) also specifies the number of times you have to run the solve function on a different set of inputs.
For each test case:
The first line contains the integer \(N\).
Output format
For each test case, print the answer in a new line.
Constraints
\(1 \leq T \leq 10\)
\(1 \leq N \leq 10^{16}\)
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.