#include <stdio.h>

int isMatch(char *pattern, char *string) {
    if (*pattern == '\0') {
        return (*string == '\0');
    }
    if (pattern[1] == '?') {
        return (pattern[0] == string[0] && isMatch(pattern + 2, string + 1)) //Call 1
               || isMatch(pattern + 2, string); //Call 2
    }
    return pattern[0] == string[0] && isMatch(pattern + 1, string + 1); //Call 3
}


int main(int argc, char *argv[]) {
    char pattern[30], string[30];
    scanf("%s %s", pattern, string);
    if (isMatch(pattern, string) == 0) {
        printf("NO ");
    }
    printf("MATCH\n");
    return 0;
}
