brute force string searching Algorithm

In computer science, brute-force search or exhaustive search, also known as generate and test, is a very general problem-solve technique and algorithmic paradigm that consists of systematically enumerating all possible candidates for the solution and checking whether each candidate satisfy the problem's statement. While a brute-force search is simple to implement, and will always find a solution if it exists, its price is proportional to the number of candidate solutions – which in many practical problems tends to grow very quickly as the size of the problem increases (§ combinatorial explosion).

brute force string searching source code, pseudocode and analysis