puts(2.times.map{gets.chars.sort.join}.uniq[1] ? :NO : :YES)