Solve the following in C++, please do not use the help of ChatGPT.
In a summation puzzle, you are given three strings of the form POT + PAN = BIB. Typically, each is a word, often with a theme to the three chosen. Your goal is to assign a distinct digit to each letter in the equation in order to make the result true. For example, if the puzzle is POT + PAN = BIB, the mapping P:2, O:3, T:1, A:7, N:4, B:5, I:0 will solve this, as 231 + 274 = 505.
You are only required to implement one function found in puzzleSolver.cpp:
bool puzzleSolver(const std::string& s1, const std::string& s2, const std::string& s3, std::unordered_map<char, int>& mapping)
- This function should return true if, and only if, the puzzle is solvable: that is, if there is a mapping of the letters that appear in the three strings to distinct digits such that the sum of the first two is the third (s1 + s2 == s3).
- You may assume it is called with three valid non-empty strings as parameters and with an otherwise empty map. The strings will always consist only of all-capital letters.
- The function must return a boolean indicating whether or not the puzzle has a solution. If the puzzle does not have a solution, your function should return false. If the puzzle does have a solution, your function should return true and have the unordered_map parameter contain said solution.