Croatian Alphabet

Interview

Time limit1sMemory limit128 MB

Summary
Parse a string left to right, greedily matching multi-character Croatian letter codes (like c=, dz=, lj), and count total letters.
Level

Easy3 of 10

Topics
String, Greedy, Implementation
Solved
No attempts yet

Problem

Some older operating systems could not type Croatian letters directly, so the letters were entered using the strings in the table below.

Croatian letterInput form
čc=
ćc-
dždz=
đd-
ljlj
njnj
šs=
žz=

Given a word, output how many Croatian alphabet letters it contains.

dz= is always counted as one letter and must not be split into d and z=. Likewise, lj and nj are always counted as one letter. Any character sequence not listed in the table is counted one character at a time.

Input

The first line contains a word of at most 100 characters.

The word consists only of lowercase English letters, -, and =. Croatian letters listed in the table are given in their corresponding input form.

Output

Output the number of Croatian alphabet letters in the given word.

Examples5

  1. Example 1

    Input
    ljes=njak
    
    Expected output
    6
    
  2. Example 2

    Input
    ddz=z=
    
    Expected output
    3
    
  3. Example 3

    Input
    nljj
    
    Expected output
    3
    
  4. Example 4

    Input
    c=c=
    
    Expected output
    2
    
  5. Example 5

    Input
    dz=ak
    
    Expected output
    3