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:
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≤T≤10
1≤N≤1016
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.
The first line contains the number of test cases.
The first test case is explained in the above example in the question.
In the second test case, the odd digits are [1,5,3] and the even digits are [2,2]. All the possible good pairs are (1,2), (1,2), (5,2), (5,2), (3,2) and (3,2). Thus the answer is 6.