CF1820A Yura's New Name

题目描述

Yura 要改名字,他想取一个只包含字符 `_` 和 `^` 的名字,并满足一定条件,即只有形如 "^\_^" 和 "^^" 的连续子串可以出现在该名字中,且这些子串能够覆盖整个名字,不同子串间可以重叠。每次操作可以在名字中插入一个字符 `_` 或一个字符 `^`,求最少需要多少次操作才能使其符合要求。

输入格式

第一行是测试数据组数 $T$。对于每组数据,只有一行,表示 Yura 的原名。

输出格式

每组数据有一行输出,输出将 Yura 名字修正最少的操作数。

说明/提示

In the first test case, you can get the following name by adding $ 5 $ characters: ^\_^\_^\_^\_^\_^\_^ In the third test case, we can add one character "^" to the end of the name, then we get the name: ^\_^ In the fourth test case, we can add one character "^" to the end of the name, then we get the name: ^^ In the fifth test case, all of the characters are already contained in smiley faces, so the answer is $ 0 $ . In the seventh test case, you can add one character "^" at the beginning of the name and one character "^" at the end of the name, then you get the name: ^\_^