using System.Collections.Generic;
using System.Text.RegularExpressions;
public static void Main()
Console.WriteLine("Hello World");
string myString = "I do not like green eggs and ham";
Console.WriteLine($"{reverseByChar(myString)}");
Console.WriteLine($"{MyReverse(myString)}");
public static string reverseByChar(string str)
return reverseByChar(str.Substring(1)) + str[0];
public static string reverseByWord(string str)
public static string reverseByChar2(String str)
if (str == null || str.Length <= 1) {return null;}
Console.Write(str[str.Length-1]);
return reverseByChar2(str.Substring(0,(str.Length-1)));
public static string MyReverse(string s)
return MyReverse(s.Substring(1)) + firstLetter;