Write a program to determine if Two Words Are Anagrams of Each Other
Two strings are said to be anagrams, if one string can be obtained by rearranging the letters of another.
For Example
Dog, god
Solution:
using System;
using System.Linq;
namespace AnagramsStrings
{
class Program
{
static void Main()
{
var str1 = "abcd";
var str2 = "dacb";
var aa = string.Concat(str1.OrderBy(c => c));
var bb = string.Concat(str2.OrderBy(c => c));
if (aa == bb)
{
Console.WriteLine("anagrams string");
}
else
{
Console.WriteLine("Not an anagrams string");
}
Console.ReadLine();
}
}
}