Getting wrong output

https://www.codechef.com/LTIME89B/problems/GSUB

my sol-https://www.codechef.com/viewsolution/39267390

please check my last test case is not passing, please tell me how to correct my code

Hey @shivamgoel150

            if(x!=1&&v[x-1]!=v[x-2])
            len--;

            if(x!=n&&v[x-1]!=v[x])
            len--;

            v[x-1]=y;

            if(x!=1&&v[x-1]!=v[x-2])
            len++;

            if(x!=n&&v[x-1]!=v[x])
            len++;

If this resolves your query then please mark it as resolved :slight_smile: