Use Inclusion/Exclusion.
Let $A$ be the subset of strings containing at least one $1$.
Let $B$ be the subset of strings containing at least one $2$.
Let $C$ be the subset of strings containing at least one $3$.
Then:
$$|(A\cap B)\cup (A\cap C)\cup (B\cap C)| = |A\cap B|+|A\cap C|+|B\cap C| - |(A\cap B)\cap(A\cap C)|-|(A\cap B)\cap (B\cap C)|-|(A\cap C)\cap (B\cap C)|+|(A\cap B)\cap (A\cap C)\cap (B\cap C)| = |A\cap B|+|A\cap C|+|B\cap C|-2|A\cap B\cap C|$$
And continuing to break this down:
$$|A\cup B| = |A|+|B|-|A\cap B|$$
$A\cup B$ is the subset of strings containing at least one $1$ or at least one $2$. So, the complement of that is a string that contains neither a $1$ nor a $2$. Thus:
$$|A\cup B| = n^k-(n-2)^k = 2(n^k-(n-1)^k)-|A\cap B|$$
This gives:
$$|A\cap B| = n^k-2(n-1)^k+(n-2)^k$$
Similarly, we can find the other intersections:
$$|A\cap B| = |A\cap C| = |B\cap C|$$
Next, we need to find $|A\cap B\cap C|$.
We have:
$$|A\cup B\cup C| = |A|+|B|+|C|-|A\cap B|-|A\cap C|-|B\cap C|+|A\cap B\cap C|$$
$$n^k-(n-3)^k = 3(n^k-(n-1)^k)-3(n^k-2(n-1)^k+(n-2)^k)+|A\cap B\cap C|$$
which yields:
$$|A\cap B\cap C| = n^k-3(n-1)^k+3(n-2)^k-(n-3)^k$$
Thus, the answer to your original question is:
$$|(A\cap B)\cup (A\cap C)\cup (B\cap C)| = 3(n^k-2(n-1)^k+(n-2)^k)-2(n^k-3(n-1)^k+3(n-2)^k-(n-3)^k) = n^k-3(n-2)^k+2(n-3)^k$$