Yet Another LCP Problem

CodeForces - 1073G