CF316G1 Good Substrings

Description

Smart Beaver recently got interested in a new word game. The point is as follows: count the number of distinct good substrings of some string $ s $ . To determine if a string is good or not the game uses rules. Overall there are $ n $ rules. Each rule is described by a group of three $ (p,l,r) $ , where $ p $ is a string and $ l $ and $ r $ $ (l

Input Format

N/A

Output Format

N/A

Explanation/Hint

There are three good substrings in the first sample test: «aab», «ab» and «b». In the second test only substrings «e» and «t» are good.