How to get User's topic's post count?

I want to get the count of user’s posts in a specific topic, it can be reply to a post or reply to the topic and how to get the data-user-card 's post count of a specific user? I would appreciate some help. Thank you!