I have this on a1 b1 and c1 downwards

AURA l elrs
VARA ns
RAYA hs
ALMA ht hs
AMLA s
LAMA lu s

I need results as follows

AURA l elrs L
VARA ns
RAYA hs
ALMA ht hs H
AMLA s
LAMA lu s

I need the formula to find common letter hook existing as front and back , example ALMA has HT as front and HS back , the common is H