The Penalty Shootout
Submissions: 4541   Accuracy:


  Difficulty: Basic   Marks: 1

Ishaan loves playing football. He is a penalty master as he practices a lot. Now during a match he wants to know how many goals does he score during a penalty.
Since he wants to focus on the match, he asks you to count the goals for him. You are given a string which consists of 3 different characters :
"0" stands for "no goal".
"1" stands for "goal".
"2" stands for a foul which gives Ishaan a penalty.
Note : You need to count only those goals which are scored on a penalty.

Input : 
First line of input contains a single integer T denoting the number of test cases.
The only line of each test case contains a string S.

Output : 
For each test case, print the required answer in a new line.

Constraints : 
1 <= T <= 100
1 <= Length of String <= 500

Example : 
Input : 

Output : 

Explanation : 
Case 1 : 
We consider only those goals which are after a penalty.
There are 3 penalties, of which he scores only 2.

Case 2 : 
Since there is no penalty in this match, answer is 0.

Case 3 : 
We consider only those goals which are after a penalty.
There are 2 penalties, of which he scores only 1.


** For More Input/Output Examples Use 'Expected Output' option **

Author: goyalanubhav11

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.

Need help with your code? Please use, generate link and share the link here.

to report an issue on this page.