Created
November 15, 2016 23:09
-
-
Save cjroth/a506b38aa76ac43e5628802165743676 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main() { | |
var t = parseInt(readLine()); | |
for(var a0 = 0; a0 < t; a0++){ | |
var R_temp = readLine().split(' '); | |
var R = parseInt(R_temp[0]); | |
var C = parseInt(R_temp[1]); | |
var G = []; | |
for(var G_i = 0; G_i < R; G_i++){ | |
G[G_i] = readLine(); | |
} | |
var r_temp = readLine().split(' '); | |
var r = parseInt(r_temp[0]); | |
var c = parseInt(r_temp[1]); | |
var P = []; | |
for(var P_i = 0; P_i < r; P_i++){ | |
P[P_i] = readLine(); | |
} | |
var string = '.*'; | |
for (var i in P) { | |
var padding = G[0].length - P[0].length; | |
string += `${P[i]}.{${padding}}`; | |
} | |
string += '.*'; | |
var reg = new RegExp(string); | |
console.log(G.join('').match(reg) ? 'YES' : 'NO'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment