// With inclusive indexing
public static bool IsPalindrome(string input) {
for (int i = 0; i < input.Length; i++) {
if (input[i] != input[^i])
return false;
}
return true;
}
// With exclusive indexing
public static bool IsPalindrome(string input) {
for (int i = 0; i < input.Length; i++) {
if (input[i] != input[^(i + 1)])
return false;
}
return true;
}