luogu#P1765. 手机

    ID: 5823 Type: RemoteJudge 1000ms 512MiB Tried: 26 Accepted: 23 Difficulty: 1 Uploaded By: Tags>字符串枚举暴力模拟NOI 导刊

手机

Problem Description

A typical mobile phone keypad looks like this:

To type an English letter, you need to press a number key multiple times. For example, to type x\tt x, you need to press 99 twice: the first press outputs w\tt w, and the second turns w\tt w into x\tt x. Pressing the 00 key once outputs a space.

Your task is to read a sentence that contains only lowercase English letters and spaces, and find the minimum number of key presses required to type this sentence on the phone.

Input Format

One line containing a sentence that consists of lowercase English letters and spaces, with length at most 200 characters.

Output Format

One line with one integer, the total number of key presses.

i have a dream
23

Hint

NOI Bulletin 2010 Junior (10).

Translated by ChatGPT 5