The solution for the problem is:
d(S,P) = √(0-0)^2 + √(b-0)^2
d(S,P) = √b^2
d(S,P) = b
so we know that, SP = b
d(P, Q) = √(a-0)^2 + √(b-b)^2
d(P, Q) = √a^2
d(P, Q) = a
so
PQ = a
SQ = c^2 = a^2 + b^2
SQ = √(a^2 + b^2)
Therefore, the answer is √(a^2 + b^2).