Each vertex in graph $G$ is composed of a string of length $3$ from digits $\{0,1,2\}$. There's an edge between two vertices iff their respective strings have only one digit in common. For example, $012$ and $021$ have an edge because their first digit is the same while the other digits are different. What is the degree of each vertex?
I think that once we choose the digit which is the same there're $3^2$ possibilities to permute the digits in the other two places. But I'm not sure this is correct.
If we fix one places in a 3-digit string then there are $2 \times 2 = 4$ possibilities for the other two places that create strings with just one digit in common with the original string.
For example, fixing the first place in $012$, we see that $012$ is linked to $000$, $001$, $020$ and $021$. So that gives us 4 edges.
If we fix the second place we get a further 4 edges. And if we fix the third place we get 4 edges again, giving a total of 12 edges. We are not double counting any edges. So each vertex has degree 12.