import re while 1:*a,=range(10);exec(re.sub('(\d)',r'a[\1]',input()));print(ans)