class Solution:
    def checkPalindromeFormation(self, a: str, b: str) -> bool:
        """String.

        Running time: O(n) where n == len(a).
        """
        i, j = 0, len(a) - 1
        while i < j and a[i] == b[j]:
            i += 1
            j -= 1
        s1, s2 = a[i:j+1], b[i:j+1]
        i, j = 0, len(a) - 1
        while i < j and b[i] == a[j]:
            i += 1
            j -= 1
        s3, s4 = a[i:j+1], b[i:j+1]
        return any(s == s[::-1] for s in [s1, s2, s3, s4])
