In count palindromic substrings output for abc should be 3, but I am getting 2

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

bool IsPalindrome(char a[])
{
int i = 0;
int j = strlen(a) - 1;

while (i < j)
{
    if (a[i] != a[j])
        return false;
    i++;
    j--;
}
return true;

}

int main()
{
char a[1000];
char x[1000];
cin >> a;
int n = strlen(a);
int cnt = 0;
int strCnt = 0;

for (int i = 0; i < n; i++)
{
    for (int j = i; j < n; j++)
    {
        for (int k = i; k <= j; k++)
        {
            // cout << a[k] << " ";
            x[cnt] = a[k];
            if (IsPalindrome(x) == true)
            {
                strCnt++;
            }
            cnt++;
        }

    }
}

cout << strCnt;

return 0;

}

I tried removing cnt++ it gives output 3 in my vscode but now it shows 10 in coding blocks IDE

hi @vinayakparashar38,
refer https://www.geeksforgeeks.org/count-palindrome-sub-strings-string/