PairMatch
Locate the unmatched pairs.
[1]
Enter
pair
in the format of
a,b
or
a b
→
pair
=
[2]
copy and paste your code below and hit [check].
function checkPair(t, pairs) { /* test sample for the PairMatch} */ if (pairs==undefined) pairs='{,}' p= pairs.split(',')[0] s= pairs.split(',')[1] ps=[] ss=[] nt='' /* test comment }} */ for (i=0;i<=t.length;i++) // looping { c=t.charAt(i) if (x==p) {ps.push(i); nt+=mark(c)} else if (x==s) { if (ps.length>0) {ps.pop()} else {ss.push(i)} nt+=mark(c) } }