We can use the heat equation,
Q = mcΔT
Where Q is the amount of energy transferred (J), m is the mass of the substance (kg), c is the specific heat (J g⁻¹ °C⁻¹) and ΔT is the temperature difference (°C).
In this problem there is no any data about initial temperature of the water. So, we can assume that given temperature of 5.2 °C as the temperature difference.
Q = 348 J
m = ?
c = 4.186 J g⁻¹ °C⁻¹
ΔT = 5.2 °C
By applying the formula,
348 J = m x 4.186 J g⁻¹ °C⁻¹ x 5.2 °C
m = 15.99 g
Hence, the grams of water is 15.99.