Your question is Merge Strings Alternately. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Infineon Technologies test utilities receive two diagnostic strings that must be merged character by character. Given strings first and second, create a merged string by taking one character from first, then one from second, repeating until both strings are exhausted. When one string ends, append the remaining characters from the other string in their original order.
Then build a hash map for the merged string. Each distinct character must map to a list of its zero-based positions in the merged string, ordered from left to right.
Return both the merged string and the character-position hash map.
first and second, containing printable ASCII characters.def merge_and_index(first, second):