Here is the sentence again:
Sima whined that she didn't have the right pencil is a main clause. At the same time, she realized ... is the beginning of the next main clause. These two parts are joined with no punctuation, causing a fused sentence.
A period after pencil and a capital A for at would take care of the problem.