public static bool AlmostPalindrome(string str)
int right = str.Length - 1;
if (str[left] != str[right])
public static void Main(string[] args)
RunTest("abcdcbg", true);
RunTest("abcdaaa", false);
RunTest("gggfgig", true);
RunTest("gggffff", false);
RunTest("gggfggg", false);
RunTest("1234312", false);
private static void RunTest(string input, bool expected)
bool result = AlmostPalindrome(input);
Console.WriteLine($"Input: {input} | Expected: {expected} | Result: {result} | Test Passed: {result == expected}");