Firstly, understand the problem, and write down any considerations & assumptions. Next write pseudocode if that helps. Considerations 1) Pre-codnition check for null or empty input. 2) Loop through the input string, and store each “character” as a key in…