update wildcard_matching more simple with O(1) space