The number of different words can be formed using all the letters from the word NARAYAN so that $N$ does not lie between any two A's, is
My solution: There are $7$ places overall so first select two places for $R,Y$ which can be done in ${7\choose 2}$ ways and there are $2!$ ways to arrange them.
Now there are three possibility for ordere of $A,N$
(i) $AAANN$
(ii) $NNAAA$
(iii) $NAAAN$
Hence final answer is ${7\choose 2}\cdot 2!\cdot 3=126$
Note: Some examples of Arrangement which is not allowed are ANA, ANNAA, ARNA, ARYNAA.
My doubt: I am looking for better method to solve this for example question is having word $AAAAABBBBBYRCD$ such that $B$ does not lie between any two A's ?