{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"Read problems statements in \u003ca target\u003d\"_blank\" href\u003d\"https://www.codechef.com/download/translated/JUNE14/mandarin/DIGJUMP.pdf\" rel\u003d\"nofollow noreferrer noopener\"\u003eMandarin Chinese \u003c/a\u003e and \u003ca target\u003d\"_blank\" href\u003d\"https://www.codechef.com/download/translated/JUNE14/russian/DIGJUMP.pdf\" rel\u003d\"nofollow noreferrer noopener\"\u003eRussian\u003c/a\u003e.\n\nChef loves games! But he likes to invent his own. Now he plays game \"Digit Jump\". Chef has a sequence of digits $S_{1}, S_{2}, \\ldots , S_{N}$. He is staying in the first digit $S_{1}$ and wants to reach the last digit $S_{N}$ in the minimal number of jumps. \n\nWhile staying in some index $i$ Chef can jump into $i - 1$ and $i + 1$, but he can\u0027t jump out from sequence. Or he can jump into any digit with the same value $S_i$. \n\nHelp Chef to find the minimal number of jumps he need to reach digit $S_{N}$ from digit $S_1$. \n\n### Input\nInput contains a single line consist of string $S$ of length $N$ - the sequence of digits.\n\n### Output\nIn a single line print single integer - the minimal number of jumps he needs.\n\n### Constraints\n- $1\\leq N \\leq 10^5$\n- Each symbol of $S$ is a digit from $0$ to $9$. \n\n"}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e01234567890\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n***Test Case 1:*** Chef can directly jump from the first digit (it is $0$) to the last (as it is also $0$)."}},{"title":"Sample 2","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e012134444444443\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e4\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n***Test Case 2:*** Chef should follow the following path: $1 - 2 - 4 - 5 - 15$.\n"}}]}