Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
two words are anagrams
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { string str1 = "heater"; string str2 = "reheat"; char[] ch1 = str1.ToLower().ToCharArray(); char[] ch2 = str2.ToLower().ToCharArray(); Array.Sort(ch1); Array.Sort(ch2); string val1 = new string(ch1); string val2 = new string(ch2); if (val1 == val2) { Console.WriteLine("Both the strings are Anagrams"); } else { Console.WriteLine("Both the strings are not Anagrams"); } } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
combine paths
Full join
blanaced parenthes
How to find the first index of a sub-string in a given string?
Regex - Leading zeros
D111
Поле дураков
removeDuplicate C#
*271*271#
Simple inheritance
Please log in to post a comment.