Please help me with this

How to approach this problem

@aryan hey, you can use trie here, what you can do is for all nodes of the trie , we calculate number of strings in the substree and then just apply combinatorics such -
NC2(total nodes in the subtree of current nodes)-summation of NC2(children in each nodes)

After finding the strings for each node’s subtree. After that what to do, can you please explain it again

@aryan hey bro that you have to apply P and c logic
just dry run this code you will get it bro

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.