NGC 147 and NGC 185 are two of the most massive satellites of the Andromeda galaxy (M 31). Close together in the sky, of similar mass and morphological type dE, they possess different amounts of interstellar gas and tidal distortion. The question therefore is, how do their histories compare? Here we present the first reconstruction of the star formation histories of NGC 147 and NGC 185 using long-period variable stars. These represent the final phase of evolution of low- and intermediate-mass stars at the asymptotic giant branch, when their luminosity is related to their birth mass. Combining near-infrared photometry with stellar evolution models, we construct the mass function and hence the star formation history. For NGC 185 we found that the main epoch of star formation occurred 8.3 Gyr ago, followed by a much lower, but relatively constant star formation rate. In the case of NGC 147, the star formation rate peaked only 7 Gyr ago, staying intense until ~ 3 Gyr ago, but no star formation has occurred for at least 300 Myr. Despite their similar masses, NGC 147 has evolved more slowly than NGC 185 initially, but more dramatically in more recent times. This is corroborated by the strong tidal distortions of NGC 147 and the presence of gas in the centre of NGC 185.