Failed 2 out of 5 test cases, how can I improve my code ?
Explanation: If you remove everything that isn't a letter or space from the original message and flip it around, you get "hello world" using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Textsing System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { string input = Console.ReadLine(); var output = new char[] {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','.','_'}; var result = string.Join("",(from x in input.ToCharArray() where output.Contains(x) select x.ToString()).ToArray()); char[] reverse = result.ToCharArray(); Array.Reverse(reverse); string reversed = new string(reverse); Console.WriteLine(reversed); } } }