I want to check whether my concept and answer is right
I am considering strings of four decimal digits that contain the same digit twice. With this, I have the possibilities of $xxyz,xyxz,yxxz,yxzx,yzxx,xyzx$ where $x$ is the same digit, and $y, z$ are randomly different decimal digits taken. So $10 \cdot 1 \cdot 9 \cdot 8 = 720$ and $6$ possibilities, then $720 \cdot 6 = 4320$ ways. Now consider digits that have pattern $xxyy, yyxx,xyxy,yxxy,yxyx,xyyx$, here $10 \cdot 1 \cdot 9 \cdot 9=810 \cdot 6= 4860$ ways. Then total combinations are $10^4 =10000$ then $10000-4320-4860=820$ ways .