Solution 1:

It's perfectly valid as is. It's not particularly unusual to have a repeated word crop up in a sentence constructed like yours, in which a clause ending in a preposition is followed by a prepositional phrase: The wrestlers weighed in in the locker room.

It looks a little odd, and the automated "grammar checkers" used in word processors aren't smart enough to parse the complexity of the sentence, but there's nothing wrong with it.

Solution 2:

Yes it's fine, as phenry says above. So we've seen repeated "to," and "in." Most prepositions can be stacked this way, and some demonstratives:

She put the paper I wrote on on the table.

And:

He said that that was correct.

However, most editors would spot this kind of construction and feel uneasy about it. Yes, these kinds of things are technically, grammatically correct, but they look awkward and clumsy, as if the writer didn't look for a more elegant alternative, viz.:

"She took the paper I had written on and placed it on the table," and "He said, 'That is correct.'"

No, these two examples are not the only available rewrites, there are other solutions. The point is that any solution that works will be more idiomatic than the originals. This is another installment of Just Because You Can Doesn't Mean You Should.