input1 = '5a+6b'
input2 = '2a+3b+9c'
s = '+'.join((input1, input2))
s
d = {}
for i in s.split('+'):
    d[i[-1]] = d.get(i[-1], 0) + int(i[:-1])
d
"""+""".join(''.join((str(j), i)) for i, j in list(d.items()))
Python string processing based on the numeric part: '5a+6b' + '2a+3b+9c' = '7a+9b+9c'