1. 程式人生 > >2014西安網路預選賽1002(字尾陣列求第K大的子串)hdu5008

2014西安網路預選賽1002(字尾陣列求第K大的子串)hdu5008

The input consists of multiple test cases.Please process till EOF. 

Each test case begins with a line containing a string s(|s| ≤ 105) with only lowercase letters.

Next line contains a postive integer q(1 ≤ q ≤ 105), the number of questions.

q queries are given in the next q lines. Every line contains an integer v. You should calculate the k by k = (l⊕r⊕v)+1(l, r is the output of previous question, at the beginning of each case l = r = 0, 0 < k < 263
, “⊕” denotes exclusive or)