Abu Huraira reported lie heard Messenger of Allah ﷺ as saying that a servant committed a sin. The rest of the hadith is the same, but there is a slight variation of wording.
سَمِعْتُ رَسُولَ اللَّهِ ﷺ يَقُولُ إِنَّ عَبْدًا أَذْنَبَ ذَنْبًا بِمَعْنَى حَدِيثِ حَمَّادِ بْنِ سَلَمَةَ وَذَكَرَ ثَلاَثَ مَرَّاتٍ أَذْنَبَ ذَنْبًا وَفِي الثَّالِثَةِ قَدْ غَفَرْتُ لِعَبْدِي فَلْيَعْمَلْ مَا شَاءَ