Brute Force String Matching, Closest Pair, Power Set, Permutations in C++