Doubt Python Mastery Exercise (No. 21)

Hi, was doing the python mastery course when i came across this exercise - cane up with this solution within 5-7 mins. Still dont understand why i cant input strings with spaces. kindly help - thanks


user_input = input(">>> ")

temp_set = set(user_input.lower())

# nums = {}

count = 0
gsum = sum2 = 0
alpha = ""

for letter in temp_set:
    for letter1 in user_input.lower():
        if letter1 == letter:
            count += 1
    if not gsum:
        gsum = count
        alpha = letter
    if gsum:
        sum2 = count
        if sum2 > gsum:
            gsum = sum2
            alpha = letter
    count = 0

print(alpha)

# HEllO

# output the L