问题

________ in the queue for half an hour, Tom suddenly realized that he had left his wallet at home.

A:To wait
B:Have waited
C:Having waited
D:To have waited
正确答案是: