If you have ever looked at an assembly language dump of an executable file, you know that commands come in the form of hexadecimal digits that are grouped by the processor into instructions. It is important that parsing can be done correctly or code will not be executed as expected. Wrong Parsing is the basis for Return Oriented Programming.
You have developed a program in a new scripting language. Of course, it requires accurate parsing in order to perform as expeced, and it is very cryptic. You want to determine how many valid commands can be made out of your lines of script. To do this, you count all of the substrings that make up a valid command. Each of the valid commands will be in the following format :
1. First letter is a lowercase English letter
2. Next, it contains a sequence of zero or more of the following characters : lowercase English letters, digits, and colons.
3. Next, it contains a forward slash ‘/’.
4. Next, it contains a sequence of one or more of the following characters : lowercase English letters, digits.
5. Next, it contains a backward slash ‘\’.
6. Next, it contains a sequence of one or more lowercase English letter.
Given some string s, we define the following :
s[i…j] is a substring containing of all the characters in the inclusive range between i and j.
For example, your command line is abc:/b1c\xy. Valid command substrings are :
abc:/b1c\xy bc:/b1c\xy c:/b1c\xy abc:/b1c\x bc:/b1c\x c:/b1c\x
There are six valid commands that may be parsed from that one command string.
Sample Input 0