#K47547. Minimum Operations to Convert Strings

    ID: 28222 Type: Default 1000ms 256MiB

Minimum Operations to Convert Strings

Minimum Operations to Convert Strings

You are given two strings S and T of equal length n consisting of lowercase English letters. The goal is to convert S into T by performing a series of operations. In one operation, you can increment any character in S by 1 (with wrap-around so that 'z' becomes 'a').

The number of operations for each character is computed as:

\( d = (T_i - S_i) \mod 26 \)

Your task is to determine the minimum total number of operations required to convert S into T.

Example: For n = 5, S = "abcde" and T = "cdefg", the total number of operations is 10.

inputFormat

The input is given in the standard input (stdin) in the following format:

  1. An integer n representing the length of the strings.
  2. A string S of length n.
  3. A string T of length n.

outputFormat

Output a single integer which is the minimum number of operations required to convert S into T. The output should be written to standard output (stdout).

## sample
5
abcde
cdefg
10

</p>