# Occurence and Position of digits in a combination lock

If you have a $6$ digits combination Lock and you can use the digits from $1 \to 9$

Now I have these two cases, how many possible combinations there are if

(case 1) Every digit that occurs in the combination, occurs exactly twice.

(case 2) The digit 1 occurs twice, but not consecutively.

For (case 1), This is what I think, The problem is that we don't know where the digits are repeated. But I thought, Imagine if we knew where the digits are repeated then we have $9 \times 8 \times 7$ different possibilities right ? And after this we are left with the problem of locality, and so I reduce the problem to the following.

How many different ways of arranging $AABBCC$, this is $\large{\frac{6!}{2 \times 2 \times 2} = 90}$ right ?

And so I multiply $(9 \times 8 \times 7) \times (90)$ to get my answer. Is this correct ?

So basically I am saying, first calculate the number of ways if you already know where are they repeated times the number of ways you can change their arrangement ?

It seems very logical to me, But I want someone to confirm or deny this argument, also, is there another way to do it ?

Now for (case 2) The digit 1 occurs twice, but not consecutively

I figured out there are 10 ways for $1$ to occur twice but not consecutively

$1 - 1 - - -$

$1 - - 1 - -$

$1 - - - 1 -$

$1 - - - - 1$

$- 1 - 1 - -$

$- 1 - - 1 -$

$- 1 - - - 1$

$- - 1 - 1 -$

$- - 1 - - 1$

$- - - 1 - 1$

And for each one of them we have 4 other places to fill but this time we only can insert digits from $2 \to 9$, and so we would have $8^4 \times 10$ in total ?

Everything is correct except one typo: $1\to 8$ in the last sentence should read $2\to 9$.
In the second case it is easy to see that there are ${5\choose 2}=10$ ways to place $1$'s non-consecutively, so full search is not needed.