s=input().strip()
p=''
c=1
for i in range(len(s)):
if len(s)>=2:
if i+1<len(s) and s[i]==s[i+1]:
c+=1
else:
p+=str(c)
p+=s[i]
c=1
else:
p+=str(c)
p+=s
print(p)
s=input().strip()
p=''
c=1
for i in range(len(s)):
if len(s)>=2:
if i+1<len(s) and s[i]==s[i+1]:
c+=1
else:
p+=str(c)
p+=s[i]
c=1
else:
p+=str(c)
p+=s
print(p)