a) How many strings of length 4 can you create?
b) How many strings of length 4 do not have consecutive characters being the same?
c) How many strings of length 4 contain neither "cab" nor "bac", or do not have consecutive characters being the same?
What i've done
a) $3^4 = 81$
b) First letter = 3 choices. Second letter onwards = 2 choices.
Thus $3 * 2^3 = 24$
c)
"cab"
Can be considered as a string with 2 characters however cab can't repeat. Thus
$3P2 = 6$
"bac"
Can be considered as a string with 2 characters however bac can't repeat. Thus
$3P2 = 6$
Hence from above, answer is $24 - 8 = 16$ ( 8 not 12 because 'ccab' 'cabb' 'bbac' and 'bacc' have been excluded.)
Is there any error in my calculations?
edit: Tagged Pic of question
