Mr. Lin gave a holiday.

TimeLimit:5000MS  MemoryLimit:128MB
64-bit integer IO format:%lld
未提交 | 登录后收藏
Problem Description

Summer vacation is coming. Mr.Lin is going to give only one company employee a paid vacation to let him travel. Because of all the employees in the company are very good, It is difficult for Mr.Lin to pick the best. so Mr.Lin came out with a question to his employees to solve. The fast employee who solve this problem can get a paid vacation and go to his life peakness. First, Mr. Lin gives you a string S and then gives you a character list containing n strings, and lets you calculate the number of the string S is good substring. A good substring is defined by this: The string can be found in a substring of all string in the character table. JQ really wants this vacation, so you can help JQ calculate how many good Substring in string S.

让你找主串里面有多少个子串在下面给你的n个串每个串都存在一个子串和主串的子串相等

单组样例主串长度不超过1e5字母表总长度不超过1e5,

一共不超过1e6


Input

There multiple test cases in the input

each test case contains n+2 lines

First line is a string S

Second line is a positive integer n, this is the number in character table.

Next n lines each line contain a string str, this is string in character table.

Input data Guarantee 


Output

One line for each test case

A integer means the number of good substring in string S.


SampleInput
aaaaa
1
aaaaa
SampleOutput
15
Submit
题目统计信息详细
总AC数2
通过人数1
尝试人数1
总提交量3
AC率33.33%
AC该题后可以添加标签
贴完标签可以获得20ACB。
并且可以获得本题所有提交代码查看权限。
点击标题可以显示标签。
如果你还没认真思考过这题,请不要查看标签
如果您已经通过了该题,请务为该题贴上标签

T^T Online Judge

[BUG反馈] [FAQ] [闽ICP备17026590号-1]
当前版本:3.24 系统时间: