Given a vector of distinct strings, we have to find the maximum number of strings which we can take such that we can arrange them consecutively only with following rules-

Two strings are a and b, then max(len(a),len(b))=N+1 ,where N is the longest common suffix of a and b.

Example- {rgy, bgy, ash, y, gy}

Output- 4

Explanation- rgy->bgy->gy->y is one of the possible outcome

Please help in upsolving this one.