Consider a string of characters $a, b, c$ only. Such a string is called good if the number of $a$'s + number of $b$'s is equal to the number of $c$'s.
Given an integer $n$, find the number of strings of length $n$ consisting only of characters $ a,b,c$ such that all of its substrings of length $k$ are good.
$ n = 3 ,k = 2 $ is $6$,
$ n = 2,k = 1 $ is $0$
I could only solve when there are only two characters but can anyone help me how to solve when there are three characters.