<reponame>blog-a1/hackeRRank
from itertools import groupby
for i, n in groupby(input()):
    a = list(n)  
    print("(", len(a), ", ", a[0], ")", end = " ", sep = "")

from itertools import groupby
for i, n in groupby(input()):
    a = list(n)  
    print("(", len(a), ", ", a[0], ")", end = " ", sep = "")