before closing switch, charge on each capacitor will be 18 microC (total capacitance*volt)
when switch is closed, potential across first capacitor will be 3V and second is 6V (find total current I and check IR of two halves)
again calculating C, you will get 9 microC on first and 36 microC on second.
so, (18-9)-(18-36) = 9+18 = 27microC had to pass through S (minus because in second half, charge flows in clockwise direction, and anti clockwise in first)
manassilaayo?? 