before = list(raw_input()) N = input() after = list(raw_input()) count = 0 for i in range(len(before)): if before[i] != after[i]:count+=1 if before.count('o') == after.count('o') and count <= N or (count == 2 and N > 0): print 'FAILURE' else: print 'SUCCESS'