Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Text;
- using System.Numerics;
- namespace ExamPreparation
- {
- public sealed class Preparation
- {
- public static void Main()
- {
- string[] input = Console.ReadLine().Split();
- string firstToken = input[0];
- string secondToken = input[1];
- bool areMagical = AreExchangeableWords(firstToken, secondToken);
- if (areMagical)
- {
- Console.WriteLine("true");
- }
- else
- {
- Console.WriteLine("false");
- }
- }
- private static bool AreExchangeableWords(string firstToken, string secondToken)
- {
- char[] uniqueFirstTokens = firstToken.Distinct().ToArray();
- char[] uniqueSecondTokens = secondToken.Distinct().ToArray();
- if (uniqueFirstTokens.Length == uniqueSecondTokens.Length)
- {
- return true;
- }
- return false;
- }
- }
- }
Add Comment
Please, Sign In to add comment