mediumHash TableSimulationStackString 0 views

Find Mirror Score of a String

You are given a string s.

You are given a string s.

We define the mirror of a letter in the English alphabet as its corresponding letter when the alphabet is reversed. For example, the mirror of 'a' is 'z', and the mirror of 'y' is 'b'.

Initially, all characters in the string s are unmarked.

You start with a score of 0, and you perform the following process on the string s:

Return the total score at the end of the process.

Find Mirror Score of a String diagram

Example 1

Input: s = "aczzx"

Output: 5

Example 2

Input: s = "abcdef"

Output: 0

Explanation: For each index i , there is no index j that satisfies the conditions.

Constraints

  • 1 <= s.length <= 10^5
  • s consists only of lowercase English letters.

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.