So I posted a similar problem before, so please don't try to close this problem. Anyway I think I did this problem correctly, but I just want to make sure if I'm understanding what this question is asking me solve. So below I have my attempt at this problem:
Let $A_{12}$ denote where 12 occurs, $A_{23}$ denote where 23 occurs, $A_{34}$ denote where 34 occurs, $A_{45}$ denote where 45 occurs, $A_{51}$ denote where 51 occurs. Also let $|U|=5!$ where there are no restrictions to the string. By gluing numbers together (i.e. 1245, 5123) and using inclusion/exclusion we get
$$\begin{aligned} |A_{12}&\cup A_{23}\cup A_{34}\cup A_{45}\cup A_{51}|\\ &= |A_{12}|+|A_{23}|+|A_{34}|+|A_{45}|+|A_{51}|\\ &\qquad-(A_{12}A_{23}+A_{12}A_{34}+A_{12}A_{45}+A_{12}A_{51}+A_{23}A_{34}\\ &\qquad\qquad+A_{23}A_{45}+A_{23}A_{51}+A_{34}A_{45}+A_{34}A_{51}+A_{45}A_{51})\\ &\qquad+(A_{12}A_{23}A_{34}+\cdots+A_{34}A_{45}A_{51})\\ &\qquad-(A_{12}A_{23}A_{34}A_{45}+\cdots+A_{23}A_{34}A_{45}A_{51})\\ &\qquad+A_{12}A_{23}A_{34}A_{45}A_{51}\\ &=\ 5(4!)-10(3!)+10(2!)-5(1!)+0\\ &=\ 75 \end{aligned}$$
Then $|U|-|A_{12}\cup A_{23}\cup A_{34}\cup A_{45}\cup A_{51}|=120-75=45$
Please help me. Thank you!
Good work! Your calculation is correct.