Help me in SOLVING BITPLAY problem

I am struck

So i am trying out this problem
Problem Link: BITPLAY Problem - CodeChef

‘’’
include <bits/stdc++.h>
using namespace std;

int orr(int a, int b){
if(a == 0 && b == a) return 0;

return 1;

}

int xorr(int a, int b){
if(a != b) return 1;

return 0;

}

int andd(int a, int b){
if(a == b && a==1) return 1;

return 0;

}

int main() {
// your code goes here
int t; cin>>t;
while(t–){
long long n; cin>>n;
long long m = 1000000007;
string s;
cin>>s;

    for(long long i=2; i<n; i=i+2){
        long long count = 0;
        if(andd(s[i-2]-'0', s[i-1]-'0') == s[i]-'0') count++;
        
        if(orr(s[i-2]-'0', s[i-1]-'0') == s[i]-'0') count++;
        
        if(xorr(s[i-2]-'0', s[i-1]-'0') == s[i]-'0') count++;
    }
    
    cout<<count % m<<endl;
}
return 0;

}
‘’’

help me rectifying my mistakes.

@battousai_02
Plzz refer the following solution for the better understanding of the logic.

#include <iostream>
using namespace std;

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int n;
	    cin>>n;
	    string s;
	    cin>>s;
	    long long int ans=1;
	    for(int i=2;i<n;i+=2)
	    {
	        int d=s[i-1]-'0'+s[i-2]-'0';
	        
	       if(s[i]=='0'&&d==0)
	       ans=(ans*3)%1000000007;
	       else if(s[i]=='0'&&d==1)
	       ans=(ans*1)%1000000007;
	       else if(s[i]=='0'&&d==2)
	       ans=(ans*1)%1000000007;
	       else if(s[i]=='1'&&d==0)
	       ans=0;
	       else if(s[i]=='1'&&d==1)
	       ans=(ans*2)%1000000007;
	       else if(s[i]=='1'&&d==2)
	       ans=(ans*2)%1000000007;
	    }
	    cout<<ans<<endl;
	}
	return 0;
}

thanks for reply. i am not able to get the logic, could you please explain it if you can!?

@battousai_02
i made cases if s[i]==‘0’
and d tells me about what i have previous two.
so if d==0 and s[i]==‘0’ i can have any operation between then therefore i have multiplied the ans with 3.
and when d==1 then i can have only & operation between then.
and if d==2 then i can have only xor operation between them.
and then similarly i have made cases for s[i]==‘1’ too.