x = input()
y = input()
res = x.count("S") * y.count("S")
print("S(" * res + "0" + ")" * res)

1401da170900e9e0d9a4535e8b396e0ff7c6b141
<mask token>

<mask token>
print('S(' * res + '0' + ')' * res)

x = input()
y = input()
res = x.count('S') * y.count('S')
print('S(' * res + '0' + ')' * res)

x = input()
y = input()
res = x.count("S") * y.count("S")
print("S(" * res + "0" + ")" * res)
