<reponame>OMEGA-Y/Baekjoon-sol<gh_stars>0
import sys
input = sys.stdin.readline

list = [-1]*26

for idx,val in enumerate(input().rstrip()):
    chr = ord(val)-ord('a')
    if list[chr] == -1:
        list[chr] = idx

print(*list)
import sys
input = sys.stdin.readline

list = [-1]*26

for idx,val in enumerate(input().rstrip()):
    chr = ord(val)-ord('a')
    if list[chr] == -1:
        list[chr] = idx

print(*list)