Typographical Ligatures

Time Limit: 1000MS

Memory Limit: 131072K

Description

Typesetting involves the presentation of textual material in graphic form on paper or some other medium. Close as it is related to our daily life, typesetting exhibits certain complexities which may be unfamiliar and sometimes unimaginable to the layman. The use of typographical ligatures is one such complexity.Compare the two appearances of the word “define” in Figure 7. Figure 7(a) illustrates the word typeset with the “fi” ligature as Knuth’s TeX does. The letters “f” and “i” are combined into a single glyph. Figure 7(b) shows the word typeset without the ligature as Microsoft Word does. The letters “f” and “i” remain separate. Other examples include the “ff”, “ffi”, “fl” and “ffl” ligatures, as shown in Figure 8. Perhaps the most notable ligature in active use is the “&” (ampersand), which originated from “et”, the Latin word for “and”.
definedefine
(a)(b)

Input

The input contains a single test case consisting of some text. The text is given on multiple lines not longer than 100 characters each. The text contains only letters (lowercase and uppercase), punctuation marks and spaces. Punctuation marks include periods, commas, semicolons, colons, single and double quotes, exclamation and question marks. Quotes are represented by “`” (left single quote), “'” (right single quote), “``” (left double quote) and “''” (right double quote), respectively. They are also recognized following the leftmost longest rule. The input ends where EOF is met.

Output

Print the number of glyphs that have to be used to typeset the given text.

Sample Input

```define, effect; office.
reflect? waffle!'''

Sample Output

23

Hint

The text in the sample is typeset as Figure 9. The 23 used glyphs are listed in Figure 10 in the order of their first appearances in Figure 9.

“‘define, effect; office.
reflect? waffle!”’

Source

PKU Campus 2008 (POJ Founder Monthly Contest

提交代码