You are given a string s.
Initially, all indices in the string are unmarked, and the total score is
The mirror of a lowercase English letter is the letter at the same distance from the opposite end of the alphabet. For instance, the mirror of 'a' is 'z', the mirror of 'b' is 'y', and the mirror of 'c' is 'x'.
Traverse the string from left to right using an index i from s.length
Find the closest unmarked index j such that j i and s[j] is the mirror character of s[i].
If such an index j exists, mark both i and j, and add i j to the total score.
If no such index exists, move to the next index without modifying the score.
Return the total score after processing all indices.
Constraints:
s.length
s consists only of lowercase English letters.
You are given a string s.
Initially, all indices in the string are unmarked, and the total score is
The mirror of a lowercase English letter is the letter at the same distance from the opposite end of the alphabet. For instance, the mirror of 'a' is 'z', the mirror of 'b' is 'y', and the mirror of 'c' is 'x'.
Traverse the string from left to right using an index i from s.length
Find the closest unmarked index j such that j i and s[j] is the mirror character of s[i].
If such an index j exists, mark both i and j, and add i j to the total score.
If no such index exists, move to the next index without modifying the score.
Return the total score after processing all indices.
Constraints:
s.length
s consists only of lowercase English letters.