There are two cases,
(i) E is to the immediate right of A.
The seat on immediate right side of E can be filled in 2 ways that is either D or F.
Remaining 3 seats can be filled in 3! ways
Total number of ways =2× 3!=12
(ii) F is at the immediate right to A.
Number of ways E can fill =3 ways
E cannot take sit on the left of A as there will be no space.
Number of ways D can fill =1 ways
The remaining seats can be filled in 2ways.
The total numbers of ways are 3×1×2=6
The required number of ways are 12+6=18