BRUTE FORCE METHOD FOR PATTERN MATCHING