using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class MagicExchangeableWords { static void Main() { var input = Console.ReadLine().Split(); var str1 = input[0].ToCharArray(); var str2 = input[1].ToCharArray(); char[] longer = str1.Length > str2.Length ? longer = str1 : longer = str2; char[] shorter = str1.Length < str2.Length ? shorter = str1 : shorter = str2; var pairsOfLetters = new Dictionary(); var IsExchangeable = false; if (str1.Length==str2.Length) { for (int i = 0; i < str1.Length; i++) { if (!pairsOfLetters.ContainsKey(str1[i]) && !pairsOfLetters.ContainsValue(str1[i])) { pairsOfLetters[str1[i]] = str2[i]; IsExchangeable = true; } else { if (!pairsOfLetters.ContainsKey(str1[i])) { pairsOfLetters[str1[i]] = str2[i]; IsExchangeable = true; } else { if (pairsOfLetters[str1[i]].Equals(str2[i])) { IsExchangeable = true; } else { IsExchangeable = false; break; } } } } } else { for (int i = 0; i < shorter.Length; i++) { if (!pairsOfLetters.ContainsKey(shorter[i])) { pairsOfLetters[shorter[i]] = longer[i]; IsExchangeable = true; } else { if (pairsOfLetters[shorter[i]].Equals(longer[i])) { IsExchangeable = true; } else { IsExchangeable = false; break; } } } for (int i = shorter.Length; i < longer.Length; i++) { for (int j = 0; j < shorter.Length; j++) { if (longer[i]==longer[j]) { IsExchangeable = true; } else { IsExchangeable = false; break; } } } } Console.WriteLine(IsExchangeable.ToString().ToLower()); } }