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.

thanuvinu94 | 467 |

kunalk02141 | 429 |

RishabhTanwar1 | 384 |

the_coder95 | 380 |

RitikRosan | 288 |

the_coder95 | 1226 |

RishabhTanwar1 | 1104 |

thanuvinu94 | 676 |

tathagat289 | 652 |

themanhasnoname | 620 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4885 |

Quandray | 4547 |

Login to report an issue on this page.