[Compound] RR – VMRR

Threads: http://vn.spoj.com/problems/VMRR/
There is a secret, that have traditionally only been circulated among VNOI admin, RR is very different interests who. Do not just stop at the rank of the table sat watching online exam or sit for hours memorizing the names of the world-famous coder, RR also like to find his name in the text string length…
Sometimes, finding his name takes a lot of time, can even spend several days and still counting error. The RR help you solve this problem in a more general way nhé.
Request
Given a string S and 2 X and Y characters. Substring count how many times XY appear in S (X and Y are two characters in a row but do not appear correct to order (Trước X Y)).
Input
Current 1: String S.
Current 2: X và Y.
Output
Including 1 single integer as a result of the problem.
Limit
String S contains no more than 10 ^ 6 characters.
All the characters in the ASCII code from the assignment 32 to 255.

————————
This article is quite simple. We only met the approval chain and if Y is increased KQ up countX, countX where X is the number of characters that appear before.
Noted:
+ In this article KQ can be very large, so we had to use long long type (in C / C ) for KQ, with pascal should choose the type Qword.
+ When entering data may have noticed some white string