We solve the three-boson problem with contact two- and three-body interactions in one dimension and analytically calculate the ground and excited trimer-state energies. Then, by using the diffusion Monte Carlo technique we calculate the binding energy of three dimers formed in a one-dimensional Bose-Bose or Fermi-Bose mixture with attractive interspecies and repulsive intraspecies interactions. Combining these results with our three-body analytics we extract the three-dimer scattering length close to the dimer-dimer zero crossing. In both considered cases the three-dimer interaction turns out to be repulsive. Our results constitute a concrete proposal for obtaining a one-dimensional gas with a pure three-body repulsion.