package main

import (
	"fmt"
)

func change(i, j,lenth int, s string) int {
	count := 0
	for k := 0; k < lenth/2; k++ {
		if s[i-k] > s[j+k] {
			left := s[j+k] + 26 - s[i-k]
			right := s[i-k] - s[j+k]
			if left < right {
				count += int(left)
			} else {
				count += int(right)
			}
		}
		if s[i-k] < s[j+k] {
			left := s[j+k] - s[i-k]
			right := s[i-k] + 26 - s[j+k]
			if left < right {
				count += int(left)
			} else {
				count += int(right)
			}
		}
	}
    return count
}

func main() {
	var s string
	fmt.Scan(&s)
    count := 0
    lenth := len(s)
    if len(s)%2 == 0{
        count = change(lenth/2-1, lenth/2,lenth, s)
    }else{
        count = change((lenth+1)/2-1, (lenth+1)/2-1,lenth, s)
    }
    fmt.Print(count)
}