expression
no sooner than; as soon as; immediately after
Used after the past tense of a verb to express that something happened right after another action, often with a sense of surprise or unexpectedness.
家を出たかと思うと、急に雨が降り出した。
No sooner had I left the house than it suddenly started raining.
彼は帰ってきたかと思うと、またすぐに出かけた。
He came home, but immediately went out again.
expression
at the thought of; when I think about
Expresses a feeling or reaction that arises just by thinking about something. Often used with emotions like sadness, worry, or excitement.
そのことを考えるかと思うと、胸が痛む。
My heart aches at the thought of that.
明日の試験のことを思うかと思うと、眠れない。
When I think about tomorrow's exam, I can't sleep.