Lets assume the velocity of the boat be X km/h and velocity of the current be y km/h.
It goes x=9 km/h in still water.
then when the boat goes against the current, its velocity is (x-y)=(9-y)km/h
For distance s, time taken in still water to cover the distance = S/9 seconds.
For same distance s, time taken while going against the current = S/(9-y) seconds
so the equation will be, S/(9-y) = 3 X (S/9)
=>1/(9-y)=1/3
=>9-y=3
=>y=6
So, the speed of the current is 6 km/h.