FANCY  FANCY NUMBERS
FANCY NUMBERS
Girls usually give only missed calls to their boyfriends and they want them to call back. These boys are now busy with their engineering subjects and cannot remember all girl friends’ mobile number. Because of this, girls make it easy for them by having fancy mobile numbers. A fancy mobile number may contain many continuous digits in it.
For example 9994442200 is a fancy mobile number because the boy can remember simply as triple nine, triple four, double two and double zero. As they are engineering students they do think different. One of the engineering students can spell the above number as double nine, nine, four, double four, two, two, double zero.
The number 100 has only 2 possibilities as it can be spelt as either one, zero, zero (or) one, double zero
Given a mobile number find the number of possibilities that the number can be remembered.
Input Specification:
The first line consists of an integer t denoting the number of test cases. Each test case consists of a mobile number of length <= 30 digits.
Output Specification:
For each test case output the number of possibilities the number can be remembered.
Input Constraints: 1<=t<=100000
Sample Input:
3 100 12345 11112
Sample Output:
2 1 8
WARNING: Huge data set! Make your I/O optimizations.
hide comments
pistachio:
20190404 14:10:02
If you have Runtime Error NZEC in Java please take into account that test no 5, 6 or 7 is not terminated by '\n' thus you have to handel EOF. 

anirudnits:
20180210 11:13:21
Got NZEC in python 3.5 but same logic got AC in C++14! 

up79:
20170625 12:11:18
AC in one go with string and cin , cout :) 

lucy_dragneel:
20170606 00:20:02
use concept of [spoiler] and [spoiler] :) Last edit: 20170802 13:04:46 

rohit9934:
20170313 15:12:40
#math tag should be removed.its #adhoc .Learn how to manipulate numbers with strings. 

kass_97:
20170106 12:39:39
Took some time until I came up with an easy solution, you can ignore the warning though :p 

Rakend Chauhan:
20161222 01:54:35
can be solved with [spoiler]. Last edit: 20161228 19:24:35 

prasoonbatham:
20161022 14:52:10
Simple logic. But there's something wrong with test case 7. Please fix it. Gives NZEC in java. 

ritik_agr:
20160625 15:19:45
@vineetpratik got AC using string ,cin,cout 

suraj:
20160622 12:33:27
accepted with use of cin and cout and string 
Added by:  cegprakash 
Date:  20111226 
Time limit:  0.120s0.802s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 