
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
String <code>t</code> can be only constructed if it is a rotated version of string <code>s</code>.
Use KMP algorithm or Z algorithm to find the number of indices from where <code>s</code> is equal to <code>t</code>.
Use Dynamic Programming to count the number of ways.