def f(h,c,b,w,ans) if b.empty? ==true && c.empty? ==true return ans end if (c=="w" && b.empty? ==true) || (c=="b" && w.empty? ==true) return ans end res=0 if c=="w" e=b.pop if e