Klwp: Group notifications by notification title

Hello all! I have a panel in my live wallpaper that shows the most recent 5 notifications as well as a total notifications counter. I am looking for a formula that will group these notifications by notification title and add a counter based on number of notifications by that title. Example of what I’d like to see based on the screenshot

(3) Platinum Warriors
(1) LTD Messaging
(1) Screenshot saved
(1) Galaxy store

And ideas? Thanks in advance!
Using Samsung S24+