Company: Swiggy_9dec
Difficulty: medium
Mirror Personalities Problem Description N people live in a town. The houses are arranged in a row. The personality of each owner is represented by a lowercase English character. Each person is in a fight with all those people who have a mirror personality to their own. Let's consider the alphabet string A as "abcdefghijklmnopqrstuvwxyz" . Let B be the reverse of string A, i.e., "zyxwvutsrqponmlkjihgfedcba" . The mirror of any character from string A is the character at the same index in string B. For example: The mirror of 'a' is 'z' . The mirror of 'b' is 'y' . The mirror of 'c' is 'x' , and so on. Given the personality of each person in the town (represented by a string S ), determine the total number of pairs of residents who are in a fight. Note: A pair (i, j) is the same as (j, i). Example Input: N = 5 S = "abzaz" Output: 4 Explanation: The personalities are at indices 0 to 4: 'a', 'b', 'z', 'a', 'z' . The mirror of 'a' is 'z' . The mirror of 'b' is 'y' . The mirror of 'z' is 'a'