All Submissions


Using 2 bits X & Y, initially (0,0)

You have to print a given string of 0 &1 in minimum instructions

Instructions available are:

A: toggles the bit X.
B: toggles the bit Y.
C: prints the value of bit X followed by bit Y.
D: prints the value of bit X.
E: prints the value of bit Y.


Input

The first line contains number of test cases T (<=500)
Each of the following T lines contains a string consisting of 0s and 1s only.
Length of string<=200.

Output
For each test case, print minimum number of instructions required to print the given string


Sample Input

4
111
000
0110
1101101


Sample Output

4
2
4
6




Setter:Jayant Mukherji

Languages: Brain,C,C++,Java,Pascal,Perl,PHP,Python,Ruby,Text

Time Limit: 1 Second(s)
Score: 100 Point(s)
Input File Limit: 50000 Bytes

Submit

Login to post clarification.

No Clarifications.

Contest

Mode Judge

Passive

Online

Overall Rankings

RankNameScore
1xyz0
2Ams0
3TIP0
4team420
5xyzz0
6asdasdasd0
7abcd0
8khankhan0
9Gabriel0
10gigel0