Preprocessing of input for won matching