Hello,
Looking for a program that can revesre a sentance in such a manner
INPUT:C# Corner is best place for developer
OUTPUT:developer for place best is corner C#
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ashok Kumar45 reputationPosted Jan 7, 2016, 3:26 AM EST
Francis SusaimichaelRank #466 · 5.4K reputationPosted Jan 7, 2016, 3:41 AM EST
{
string yourInput = "C# Corner is best place for developer";
string output = String.Join(" ", yourInput.Split(' ').Reverse());
Console.WriteLine(output);
Console.ReadLine();
}
Rajeesh MenothRank #118 · 18.4K reputationPosted Jan 7, 2016, 4:00 AM EST
Ankur MistryRank #86 · 23.9K reputationPosted Jan 7, 2016, 5:35 AM EST
string inp = "hai how are you?"; StringBuilder strb = new StringBuilder(); List charlist = new List(); for (int c = 0; c inp.Length; c++ ) { if (inp[c] == ' ' || c == inp.Length - 1) { if (c == inp.Length - 1) charlist.Add(inp[c]); for (int i = charlist.Count - 1; i >= 0; i--) strb.Append(charlist[i]); strb.Append(' '); charlist = new List(); } else charlist.Add(inp[c]); } string output = strb.ToString();MahaRank #2,573 · 543 reputationPosted Jan 7, 2016, 12:18 PM EST
Rajeev PunhaniRank #551 · 4.4K reputationPosted Jan 7, 2016, 6:47 PM EST