a = '' b = readline().split(';') for (c in b) { d = b[c].split(':') e = d[0] f = d[1] if (e && f) { for (g in f) a += e[f[g]] a += '\n' } } putstr(a)