Energy spectra of electrons and gamma rays produced by the electron accelerator in thunderclouds