Trust Me , You Can Solve It ;-)

Nafis Shahriar loves to do codeforces programming contests. He is the first candidate master in codeforces from MBSTU. One day he found a problem. As he was busy practicing the suffix array, he gave the problem to his juniors.

This is a companion discussion topic for the original entry at

what’s the idea to solve this problem?

Editorial: :slight_smile: