using System.Collections.Generic;
public static void Main()
var str1 = "thecarisnotworking";
Console.WriteLine(isSubsequence(str1, str2));
public static bool isSubsequence(string str1, string str2) {
if(str1.Length == 0) return true;
if(str2.Length == 0) return false;
if(str2[0] == str1[0]) return isSubsequence(str1.Slice(0, 1), str2.Slice(0, 1));
return isSubsequence(str1, str2.Slice(0, 1));
public static class Extensions
public static string Slice(this string source, int start, int end)
end = source.Length + end;
return source.Substring(start, len);