Transform Approximate pattern matching problem to maximum Flow problem