Given a number. The number may contain many same continuous digits in it. The task is to count number of ways to spell the number.

For example, consider 8884441100, one can spell it simply as triple eight triple four double two and double zero. One can also spell as double eight, eight, four, double four, two, two, double zero.

Examples:

```
Input : num = 100
Output : 2
The number 100 has only 2 possibilities,
1) one zero zero
2) one double zero.
Input : num = 11112
Output: 8
1 1 1 1 2, 11 1 1 2, 1 1 11 2, 1 11 1 2
11 11 2, 1 111 2, 111 1 2, 1111 2
Input : num = 8884441100
Output: 64
Input : num = 12345
Output: 1
Input : num = 11111
Output: 16
```

**Input:**

The first line of input contains an integer T denoting the no of test cases. Then T test cases follow . The first line of each test case contains an integer N.

**Output:**

For each test case in a new line print number of ways we can spell N.

**Constraints:**

1<=T<=100

1<=N<=10^50

**Example:
Input**

2

100

11112

**Output**

2

8

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

msriramvarma01 | 25 |

AbhilashKumar2 | 24 |

monusinghal | 24 |

tripurari_IT | 24 |

Abreez Das | 23 |

ARUN_PUNDIR | 609 |

manishgupta8497 | 607 |

KhyatiSoneji | 501 |

Abhimanyu_kumar | 487 |

vvggfggcg | 453 |

blackshadows | 5333 |

Ibrahim Nash | 5221 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.