#include <stdio.h>                                                                                                                                         
#include <string.h>                                                                                                                                        
                                                                                                                                                           
int main(void)                                                                                                                                             
{                                                                                                                                                          
        char org[51] = { 0 };                                                                                                                              
        char tmp[51] = { 0 };                                                                                                                              
        char t_str[51] = { 0 };                                                                                                                            
        int i, j, k, t_len, org_len, is_match = 0;                                                                                                         
                                                                                                                                                           
        scanf("%s", org);                                                                                                                                  
        scanf("%s", t_str);                                                                                                                                
        org_len = strlen(org);                                                                                                                             
        t_len = strlen(t_str);                                                                                                                             
                                                                                                                                                           
        for (i = org_len - t_len; i >= 0; i--) {                                                                                                           
                strcpy(tmp, org);                                                                                                                          
                for (j = i, k = 0; k < t_len; j++, k++) {                                                                                                  
                        if (tmp[j] == t_str[k]) {                                                                                                          
                                ;                                                                                                                          
                        } else if (tmp[j] == '?') {                                                                                                        
                                tmp[j] = t_str[k];                                                                                                         
                        } else {                                                                                                                           
                                break;                                                                                                                     
                        }                                                                                                                                  
                        if (k == t_len - 1) {                                                                                                              
                                is_match = 1;                                                                                                              
                        }                                                                                                                                  
                }                                                                                                                                          
                if (is_match == 1) {                                                                                                                       
                        break;                                                                                                                             
                }                                                                                                                                          
        }                                                                                                                                                  
        if (is_match == 0) {                                                                                                                               
                printf("UNRESTORABLE\n");                                                                                                                  
        } else {                                                                                                                                           
                for (i = 0; i < org_len; i++) {                                                                                                            
                        if (tmp[i] == '?') {                                                                                                               
                                tmp[i] = 'a';                                                                                                              
                        }                                                                                                                                  
                }                                                                                                                                          
                printf("%s\n", tmp);                                                                                                                       
        }                                                                                                                                                  
        return 0;                                                                                                                                          
}

Measured memory_bytes: 256