I have this list:
list = {V1, A1, B1, A2, B2, B1 A1, V2}
I want to replace sequences like A1, B1 with {A1, B1} if they exist, and A2, B2 with {A2, B2}, B1, A1 with {B1, A1}, etc. The desired result should be:
{V1, {A1, B1}, {A2, B2}, {B1 A1}, V2}
Does anyone know of a neat way to accomplish this?