Hadith 859
Abu Hurairah (May Allah be pleased with him)reported in the Hadith concerning the person who was at fault in performing his Salat (prayer):
عن أبي هريرة رضي الله عنه في حديث المسيء صلاته أنه جاء فصلى، ثم جاء النبي صلى الله عليه وسلم، فسلم عليه، فرد عليه السلام، فقال: "ارجع فصلِ، فإنك لم تصلِ" فرجع فصلى، ثم جاء فسلم على النبي صلى الله عليه وسلم، حتى فعل ذلك ثلاث مرات” ((متفق عليه))
He came to the Prophet (ﷺ) and greeted him. The Prophet (ﷺ) responded to the greeting and said, "Go back and repeat your Salat because you have not performed the Salat (properly).'' He again performed Salat as he had prayed before and came to the Prophet (ﷺ) and greeted him. The Prophet (ﷺ) responded to the greetings (and repeated his words to him). This act of repeating (the Salat and the Salam) was done thrice. [Al-Bukhari and Muslim].
In plain words
A man who had prayed incorrectly greeted the Prophet each time he returned, and the Prophet returned the greeting every time across three repetitions. It shows greeting again is fitting even after a very short while.
Reference : Riyad as-Salihin 859 In-book reference : Book 5, Hadith 16