def reverse_only_letters(str_input):
    """ 1. identify letters
        2. remove the letters from the original array
            and put in a new array of letters
        3. Reverse the array of letters
        4. in the original array, replace the empty spaces by
            the letters in the array of letters
    """
    
    char_array = []
    output_array = list(str_input)
    for idx in range(len(output_array)):
        if output_array[idx].isalpha():
            char_array.append(output_array[idx])
            output_array[idx] = '0'
            
    for idx in range(len(output_array)):
        if output_array[idx] == '0':
            output_array[idx] = char_array.pop()
            
    return "".join(output_array)
    
print("Hello World!")
sample1 = "ab-cd"
sample2 = "a-bC-dEf-ghIj"
sample3 = "Test1ng-Leet=code-Q"
result1 = reverse_only_letters(sample1)
print(f"result1: {result1}")
assert(result1 == "dc-ba")
result2 = reverse_only_letters(sample2)
print(f"result2: {result2}")
assert(result2 == "j-Ih-gfE-dCba")
result3 = reverse_only_letters(sample3)
print(f"result3: {result3}")
assert(result3 == "Qedo1ct-eeLg=ntse-T")
print("Good-bye World")