主要方法转自http://http://blog.csdn.net/struggle_mind/article/details/8038328
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#define eps 1e8
#define LMT 100003
using namespace std;
char str[LMT],word[LMT];
int ppos[LMT],far[LMT],dp[LMT],len,llen;
//要记得的是子串一定有一个起点,若无法确定,就贪心一下,取个最远的
int main()
{
int n,ans,pos,pre;
scanf("%s",str);
len=strlen(str);
scanf("%d",&n);
for(int i=0;i<len;i++)far[i]=eps;
while(n--)
{
scanf("%s",word);
llen=strlen(word);
for(int i=0;i+llen<=len;i++)//单词很短,所以只需要用暴力的手法
{
int t;
for( t=0;t<llen;t++)
if(str[i+t]!=word[t])brea