solution to 8.. mostly string manipulation tbh.