Under construction

Still being built. Things may change

Spelling

Time limit2sMemory limit1024 MB

Summary
Given an uppercase string, find the minimum total number of pen lifts needed to write it, using a fixed lift count per letter.
Level

Easy3 of 10

Topics
Implementation
Solved
No attempts yet

Statement

Frankenstein likes Marta a lot, but he does not know how to tell her. After thinking it over, he decided to write her a letter confessing his love. His spelling is the problem, though. He is big and clumsy.

Frankenstein composed the letter in his head and sat down to write. He wanted the text to look as neat as possible, so he planned to lift the pen from the paper as few times as he could. Retracing a line is also hard. By 'one place' he means a line of nonzero length. He decided to write each letter separately so he would not get confused. He based the letter shapes on a picture from an English textbook he found:

For example, to write the letter A, Frankenstein has to lift the pen 2 times (he also lifts the pen after finishing the letter). Writing the letter B takes 1 lift.

Input

The first and only line of the input contains the text Frankenstein wants to write. The text consists of uppercase Latin letters and its length does not exceed 1000.

Output

Print a single line with the minimum number of times Frankenstein has to lift the pen from the paper to write the text.

Examples4

  1. Example 1

    Input
    A
    
    Expected output
    2
    
  2. Example 2

    Input
    WA
    
    Expected output
    3
    
  3. Example 3

    Input
    AC
    
    Expected output
    3
    
  4. Example 4

    Input
    IAMGROOT
    
    Expected output
    13