See my code below:
string s1 = "madam"; string s2 = string.Empty; int length = s1.Length-1; for (int i = length; i