# Strings and Lcp

We are given a string S with |S|=N
We have to answer Q queries
Each query has an integer x as input
We have to report
$$\sum_{i=x}^n LCP(i,x)$$
Where Lcp(i,x) denotes the length of the largest common prefix of suffix[i,N] and suffix[x,N]