I'm trying to find how may times two string matches in c, if we have two or more stars, multiple string combination can be suitable. e.g `"abcdb"` & `"*b*"` matches two times. my current code works but it returns four. I don't what I am missing here.

```
#include <stdio.h>

int nmatch(char *s1, char *s2) {
    if (*s1 != '\0' && *s2 != '\0' && *s2 == '*' && (*s2 + 1) != *s1) {
        return nmatch(s1 + 1, s2) + 1;
    }
    if (*s1 == *s2) {
        return nmatch(s1 + 1, s2 + 1);
    }
    if (*s1 == *s2 && *s1 == '\0' && *s2 == '\0') {
        return 0;
    }
    return (1);
}

int main() {
    char ap[] = "abcd";
    char ab[] = "*b*";
    printf("%d", nmatch(ap, ab));
    return 0;
}

```