What is vertex degree if each vertex represents a string of $\{0,1,2\}$ and there's edge between vertices iff the strings have one digit in common? 
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.

There are a total of $27$ vertices in the graph. The number of string containing only $1$ and $2$ is $8$, hence there are $19$ vertices in which $3$ appears. Similarly for $1$ and $2$.
For the vertices we have the following:
$3$ contain a single digit
$18$ contain exactly $2$ digits
$6$ contain all $3$ digits
Using the information above we have:
The $3$ single digit vertices are of degree $19-1=18$
The $18$ vertices containing $2$ digits are of degree $26-1=25$
The $6$ remaining vertices are of degree $26$
