rewrite leetcode wild card matching