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 == 2 and N > 0) or count <= N): print 'FAILURE' else: print 'SUCCESS'