Bob has several pennant flags, each of which is either red, white or blue. To celebrate his national pride in the upcoming Olympics, he wants to string together 9 pennant flags, such that each of the colors is represented at least once, and no two consecutive flags have the same color.
How many different strings of 9 flags can Bob create?
Note: The string is an arrangement of 9 flags from left to right. 2 strings are different if the arrangements of the colors of those 9 flags are different.