Algorithm to reconstruct sentence from shuffled string
This is NP-hard, so it's very unlikely there's a polynomial-time solution.  To see this, notice that any instance of the NP-hard problem Exact Cover can easily be encoded as an instance of your problem in such a way that there is a solution to this encoded instance if and only if there is a solution to the original Exact Cover instance.