Reprompting: Automated Problem-solving Optimization for LLMs