Paper-based algorithm to find longest formula which is common to at least two formulas
For each pair of formulas $f_i,f_j$ from your list, find the longest formula common to both $f_i,f_j$.  If things are as in your example, this is as simple as a set intersection.  That gives you $n(n-1)/2$ candidates.  Take the candidate that is the longest.