Google is your friend: Be nice and visit him often. He can answer questions a lot more quickly than posting them here...
A very quick search
using the beginning of your subject as the search term gave half a million hits:
Rearrange the characters of the string such that no character appears in its original position - Google Search[
^]
So your homework has been searched for - and done - many times before.
The top link gives you the algorithm, and full code!
Rearrange a string so that all same characters become d distance away - GeeksforGeeks[
^]
But...do bear in mind that your tutor has access to Google as well, and will recognise stolen code... :laugh:
In future, please try to do at least basic research yourself, and not waste your time or ours.