Source Code
#include <stdio.h>

int main(){
    long long n;
    scanf("%lld",&n);
    int a[n];
    long long x;
  scanf("%lld",&x);
  int i = n-1;
  while(i >= 0){
    a[i] = x%10;
    x = x/10;
    i--;
  }
    long  count = 0; 
    for(int i = 0; i < n/2; i++){
        if(a[i] == a[i+1]) count ++;
        
    }
    for(int i = n-1; i > n/2; i--){
        if(a[i] == a[i-1]) count ++;
    }
    printf("%ld",count);
}
Copy
Pop Pop Ayoooy
GNU G++17
2 ms
376 KB
Wrong Answer