Ad
  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    Yodau. The difference of 0 means that st[i] and st[l-1-i] are the same symbol, so if we change them, we will get a pair of identical symbols (for example: abs('c' - 'c') = 0, and if we change both symbols according to the rules of the task, we will get the following pairs: "bd", "bb", "db", "dd". As we can see, there is at least one pair that can be a palindrome).
    The difference of 2 means that in the alphabet between the symbols st[i] and st[l-1-i] there is one symbol (for example, abs('b' - 'd') = 2, and in the alphabet we see a b c d e, between b and d there is one letter. Therefore, if we change these symbols according to the rules of the task, we will get the following pairs: "ae", "ac", "ce", "cc". As we can see, there is at least one pair that can be a palindrome).
    In other cases, after the change we will not have pairs with the same symbols.