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.

ramabhatta | 35 |

Shubham Awasthi | 34 |

pguptacse17 | 30 |

abhithakur588 | 28 |

adityasuman2025 | 27 |

the_coder95 | 1236 |

RishabhTanwar1 | 1104 |

thanuvinu94 | 676 |

tathagat289 | 664 |

themanhasnoname | 620 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4889 |

Quandray | 4547 |

Login to report an issue on this page.