#P7678. Counting Croatian Letters
Counting Croatian Letters
Counting Croatian Letters
In the early days of computing, computers were unable to display certain characters from the Croatian alphabet. To overcome this limitation, programmers replaced these undiplayable characters with sequences of two or three characters. The following table shows the mappings:
Undisplayable Letter | Replacement |
---|---|
č | c= |
ć | c- |
dž | dz= |
ñ | d- |
lj | lj |
nj | nj |
š | s= |
ž | z= |
For example, the string ljes=njak
represents the following six Croatian letters: lj
, e
, s=
, nj
, a
, and k
.
Your task is to count the number of Croatian letters contained in a given string. When matching the letters, apply a greedy matching approach, which means you should match the longest possible sequence. For instance, lj
should be matched as a single letter, not as the letters l
and j
.
The complete Croatian alphabet in this problem includes the above special sequences as well as the standard 26 English letters (a
–z
).
Note: If a sequence could form a special letter, it should be taken as such over separate letters.
inputFormat
The input consists of a single line containing a non-empty string, which consists of lowercase letters and the special character sequences described above. The length of the string does not exceed 100.
outputFormat
Output a single integer that represents the number of Croatian letters in the decoded string.
sample
ljes=njak
6