CF79C.Beaver

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

After Fox Ciel got off a bus, she found that the bus she was on was a wrong bus and she lost her way in a strange town. However, she fortunately met her friend Beaver Taro and asked which way to go to her castle. Taro's response to her was a string ss , and she tried to remember the string ss correctly.

However, Ciel feels nn strings b1,b2,... ,bnb_{1},b_{2},...\ ,b_{n} are really boring, and unfortunately she dislikes to remember a string that contains a boring substring. To make the thing worse, what she can remember is only the contiguous substring of ss .

Determine the longest contiguous substring of ss that does not contain any boring string, so that she can remember the longest part of Taro's response.

输入格式

In the first line there is a string ss . The length of ss will be between 11 and 10510^{5} , inclusive.

In the second line there is a single integer nn ( 1<=n<=101<=n<=10 ). Next nn lines, there is a string bib_{i} ( 1<=i<=n1<=i<=n ). Each length of bib_{i} will be between 11 and 1010 , inclusive.

Each character of the given strings will be either a English alphabet (both lowercase and uppercase) or a underscore ('_') or a digit. Assume that these strings are case-sensitive.

输出格式

Output in the first line two space-separated integers lenlen and pospos : the length of the longest contiguous substring of ss that does not contain any bib_{i} , and the first position of the substring (0-indexed). The position pospos must be between 00 and slen|s|-len inclusive, where s|s| is the length of string ss .

If there are several solutions, output any.

输入输出样例

  • 输入#1

    Go_straight_along_this_street
    5
    str
    long
    tree
    biginteger
    ellipse
    

    输出#1

    12 4
    
  • 输入#2

    IhaveNoIdea
    9
    I
    h
    a
    v
    e
    N
    o
    I
    d
    

    输出#2

    0 0
    
  • 输入#3

    unagioisii
    2
    ioi
    unagi
    

    输出#3

    5 5
    

说明/提示

In the first sample, the solution is traight_alon.

In the second sample, the solution is an empty string, so the output can be «0 0», «0 1», «0 2», and so on.

In the third sample, the solution is either nagio or oisii.

首页