Help me in solving ADACRA problem

My issue

please help me to solve this problem

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--){
	    string s;
	    cin>>s;
	    int cnt=1;
	    for(int i=0;i<(s.length()-1);i++){
	        if(s[i]!=s[i+1]){
	            cnt++;
	        }
	    }
	    cout<<cnt/2<<endl;
	}
	return 0;
}

Problem Link: Ada and crayons Practice Coding Problem