Helping Beksin Jho

Limits: 3s, 1.0 GB

Beksin Jho is a very talented boy. Like all of you guys, he also has great interest in programming and problem solving. That’s why he always spends his leisure time in learning new algorithms and techniques for solving different problems. Recently he started working with strings in C++ and has learned how to find if a string S is a substring of T or not. He wrote the following function to check and count how many times string S occurs as a substring in string T:

This is a companion discussion topic for the original entry at