S = input().strip() T = input().strip() if S.find(T) < 0: print(0) exit(0) if len(T) == 1: print(-1) exit(0) cnt = 0 pos = 0 while True: tmp = S.find(T, pos) if tmp >= 0: cnt += 1 S = S[:tmp + len(T) - 1] + '.' + S[tmp + len(T)- 1:] pos = tmp + len(T) print(S) input('') else: break print(cnt)