Hm, I think it might depend on where they are in relation to the doubloon.
And possibly each other.
And if the pirate has anything on him to distract the racoon.
But racoons are pretty smart, so as long as the doubloon weren't, like, locked up in something that the racoon wouldn't physically be able to open, I'd probably have to say the racoon, assuming he didn't get distracted by something else before he got there.
*nodnod*