solve the wildcard matching problem but the oj time limit exceeds