You're right. I will need to do some search for the shift but I don't want it to be an exhaustive search or brute force (26 attempts).
Also, this is not going to be for short texts. It's meant to be for long paragraphs that adhere to that letter frequency you linked from Wikipedia.
I am just having difficulty in doing that using std::map.
I have the idea in my mind.
1. find most frequent letter
2. calculate its difference from most frequent letters in English (e, t, a, o, i, n, s...etc)
3. switch every letter in the word back to where it was
4. check if words == words from original text using dictionary.
I got part 1 done and I can do part 2.
but I don't know how I would do part 3.