comefrom: <doocs>1790.Check if One String Swap Can Make Strings Equal_1.py
code: def areAlmostEqual( s1: str, s2: str) -> bool:
      cnt, n = 0, len(s1)
      c1 = c2 = None
      for i in range(n):
          if s1[i] != s2[i]:
              cnt += 1
              if (cnt == 2 and (s1[i] != c2 or s2[i] != c1)) or cnt > 2:
                  return False
              c1, c2 = s1[i], s2[i]
      return cnt == 0 or cnt == 2
masked: def sample_funcname ( var_0 : str , var_2 : str ) -> bool :
      var_5 , var_7 = 0 , len ( var_0 )
      var_10 = var_8 = None
      for var_12 in range ( var_7 ) :
          if var_0 [ var_12 ] != var_2 [ var_12 ] :
              var_5 += 1
              if ( var_5 == 2 and ( var_0 [ var_12 ] != var_8 or var_2 [ var_12 ] != var_10 ) ) or var_5 > 2 :
                  return False
              var_10 , var_8 = var_0 [ var_12 ] , var_2 [ var_12 ]
      return var_5 == 0 or var_5 == 2
  