Answer: Theta = 13 degrees
==========================================================
Rule:
If cos(A) = sin(B), then A+B = 90
This can be proven through the use of drawing a right triangle with acute angles A and B. Let's say C is the 90 degree angle.
Then note how cos(A) = adjacent/hypotenuse = AC/AB while sin(B) = opposite/hypotenuse = AC/AB. We see that both evaluate to AC/AB. So this confirms cos(A) = sin(B) is true.
The condition that A+B = 90 is from from the fact that any pair of acute angles of a right triangle are complementary angles.
-------------------------
Using that rule, we can say
cos(77) = sin(theta)
leads to
77+theta = 90
and that solves to
theta = 90-77 = 13