logo AlgoBeat OnlineJudge
登录 注册

#215824. [JAG 2025 Summer Camp #2] Broken Keyboard

内存限制:1024 MiB 时间限制:2000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You have a keyboard with keys. Initially, key () is mapped to the -th lowercase English letter, i.e., key to ‘a’, key to ‘b’, ..., and key to ‘y’. You also have an empty string .

You can perform the following two operations any number of times, in any order:

  1. Choose an integer () and a lowercase English letter , and change the mapping of key to . This operation costs .
  2. Choose an integer (), and append the letter currently mapped to key to the end of . This operation costs .

You are given a string consisting of lowercase English letters. Find the minimum total cost required to make equal to .

输入格式

The input consists of a single test case in the following format.

The only line contains a string consisting of lowercase English letters. The length of is between and , inclusive.

输出格式

Print the minimum total cost as an integer.

样例

样例输入 1

meatthezoo

样例输出 1

1

样例输入 2

zxcvbnmqwertyuiopasdfghjklzxcvbnm

样例输出 2

2