You are given an array A of N integers. You need to make all the elements of the array even.

Now, to make an element even, you can add 1 to any element of the array. Also, when any element of the array is converted to even, any neighbouring element which is odd, can also be made even without adding 1 yourself.

For example,

4,5,7,6

If you add 1 to 2nd element, i.e. 5, the neighbouring 7 can also be made even without adding anything.

To make it easy for you, the array is given in the form of a string S( of length N ) of O's and E's, where O stands for "odd" integer and E stands for "even" integer.

Find the minimum number of 1's you need to add in order to make the array even.

**Input : **

First line of input contains a single integer T denoting the number of test cases.

The only line of each test case contains an string S.

**Output : **

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

**Constraints :**

1 <= T <= 100

1 <= N <= 1000

**Example :
Input : **

3

EOOE

OEEOE

OOOO

1

2

1

**Explanation : **

**Case 1 :**

Initially : EOOE

We add 1 to the 2nd element. Its neighbouring 3rd element is also made even.

So we add 1 to only the 2nd element.

**Case 2 : **

Initially : OEEOE

We first add 1 to the 1st element. None of its neighbouring element is odd, so nothing can be done here.

Then we add 1 to the 4th element. None of its neighbouring element is odd, so nothing can be done here.

**Case 3 : **

Initially : OOOO

We first add 1 to the 1st element. Its neighbouring 2nd element which is odd, is converted to even. Now the neighbouring 3rd element of 2nd element is odd, so it is also converted to even. Similarly the 4th element is also made even.

We added 1 only to the 1st element, so answer is 1.

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.

VISHESHA SADU | 27 |

ghanshyam648 | 25 |

Biswajit3 | 21 |

karthik_kasaragadda | 20 |

tanya_sharma | 18 |

KshatriyaYash | 1066 |

nikhil_sojan | 978 |

lonecoder | 935 |

mazumderrohit8 | 864 |

SumitSingh27 | 832 |

blackshadows | 5327 |

Ibrahim Nash | 5215 |

akhayrutdinov | 5111 |

mb1973 | 4468 |

Quandray | 4444 |

Login to report an issue on this page.