Nonthermal dark matter from cosmic strings