Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace _05.MagicExchangeableWords
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Вариант 2- не хваща всички случаи
- string[] input = Console.ReadLine().Split(' ').ToArray();
- string word1 = input[0];
- string word2 = input[1];
- //сравняваме само уникалните символи
- int w1 = word1.ToCharArray().Distinct().Count();//трие всички повтарящи се членове, в случая символи (заложено е сравнение)
- int w2 = word2.ToCharArray().Distinct().Count();// и в този стринг трие повторенията
- if (w1 == w2) //сравняват се дължините на неповтарящите се cw
- {
- Console.WriteLine("true");
- }
- else
- {
- Console.WriteLine("false");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement