Cryptographer's Conundrum

No attempts yetTime limit1sMemory limit256 MB

Problem

The corridor walls of the Theoretical Computer Science group at KTH are almost entirely covered with whiteboards. Several people in the group are cryptographers, and they like to write cryptographic puzzles on those whiteboards. A new puzzle goes up whenever someone works out the answer to the previous one.

When Per walked down the corridor two weeks ago, the newest puzzle read GuvfVfNGrfg. Back at his computer he quickly worked out that this was ThisIsATest encrypted with ROT13.

The weak puzzles continued the next week, when a new one read VmkgdGFyIHPDpGtlcmhldGVuIHDDpSBzdMO2cnN0YSBhbGx2YXIK. That was just base64-encoded text. Per decided the pranks had gone on long enough and that he would answer back.

Per's plan is this. Every day he erases one letter of the cipher text and writes a different letter in its place, so that in the end the whole text reads as his own name repeated, like PerPerPerPerPerPerPer. Since he changes only one letter a day, he hopes nobody will notice.

Per wants to know how many days it takes to turn a given cipher text into a text that contains only his name. You may assume the length of the original cipher text is a multiple of 3.

For simplicity, ignore the case of the letters and assume every letter is upper-case.

Input

The first and only line contains the cipher text on the whiteboard. It consists of upper-case letters only, and its length is at most 300 and a multiple of 3.

Output

Print the number of days needed to change the cipher text into a text containing only Per's name, that is, into copies of PER written one after another.