Sahih al-Bukhari 796
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
إِذَا قَالَ الإِمَامُ سَمِعَ اللَّهُ لِمَنْ حَمِدَهُ. فَقُولُوا اللَّهُمَّ رَبَّنَا لَكَ الْحَمْدُ. فَإِنَّهُ مَنْ وَافَقَ قَوْلُهُ قَوْلَ الْمَلاَئِكَةِ غُفِرَ لَهُ مَا تَقَدَّمَ مِنْ ذَنْبِهِ "
Narrated Abu Huraira:
Allah's Messenger (ﷺ) said, "When the Imam says, "Sami`a l-lahu liman hamidah," you should say, "Allahumma Rabbana laka l-hamd." And if the saying of any one of you coincides with that of the angels, all his past sins will be forgiven."
Full reference and source
Sahih al-Bukhari 796 In-book : Book 10, Hadith 191 USC-MSA web (English) : Vol. 1, Book 12, Hadith 762 (deprecated)
View source on Sunnah.com (opens in a new tab)