**Case 1: CDXXXXXX**

Case 2: DDCDXXXX

Case 3: DDDDCDXX

Case 4: DDDDDDCD

Case D: DDDDDDDC

**Case A: DCDXXXXX**Case 2: DDCDXXXX

**Case B: DDDCDXXX**Case 3: DDDDCDXX

**Case C: DDDDDCDX**Case 4: DDDDDDCD

Case D: DDDDDDDC

Where D can be A or B. and X can be A, B, or C. So, D has 2 possibilities and X has 3 possibilities. We can find the total strings by the following calculations:

2*(3^6) = 1458

(2^2)*(3^5) = 972

(2^3)*(3^4) = 648

(2^4)*(3^3) = 432

(2^5)*(3^2) = 288

(2^6)*3 = 192

(2^6)*3 = 192

Summing them up this time we get:

1458+972+648+432+288+192+192 = 4182

6561 - 4182 = 2379

We get 2379 valid strings this time.