Can someone help me solve this Coding problem?

Posted by Plane_Pen_1520@reddit | learnprogramming | View on Reddit | 23 comments

We are given 2 strings Src and Target. We have to convert Src to target by performing operations. an operation involves removing a suffix from the current string and add it to the beginning (For eg. "abcd" -> "cdab" or "dabc" or "bcda").
We have to tell how many different ways of converting Src to Target using exactly K operations. A way is different if there is at-least one time where the sequence of operations was different.