#include #define on(x , y) ((x) & (1<<(y))) #define X first #define Y second using namespace std; typedef pair < int , int > point; int T; int main(){ cin>>T; while(T--){ char lst = '$'; int ans = 0; string str; cin>>str; for(int j = 0 ; j < str.size() ; j++){ if(str[j] != lst) ++ans; lst = str[j]; } cout<<(ans >> 1)<