approximate pattern matching problem