Help me to Reverse a string without Replacing the position of the Special charactor in it
input : Pro#gramm&ing
output: gni#mmarg&orP
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
Jenith ThakkarRank #789 · 2.9K reputationPosted Aug 12, 2018, 10:22 PM EDT
var reversedWords = string.Join(" ",
Cynthia SathuragiriRank #937 · 2.2K reputationPosted Aug 15, 2018, 10:29 PM EDT
Mageshwaran RRank #411 · 6.1K reputationPosted Nov 23, 2019, 7:10 AM EST
Posted Dec 2, 2019, 5:58 PM EST
Ramachandran MRank #2,660 · 522 reputationPosted Dec 2, 2019, 8:20 PM EST
string strOriginal = string.Empty;
char[] reversed = str.ToCharArray().Reverse().ToArray();
foreach (char chr in reversed)
{
strOriginal = strOriginal + chr.ToString();
}
Console.WriteLine(str);
char[] reversed = str.ToCharArray().Reverse().ToArray();
Console.WriteLine(str);
Console.WriteLine(reversed);