Faulty problem


Submit solution

Points: 4 (partial)
Time limit: 1.0s
JAVA11 2.0s
Java 8 2.0s
Pypy 3 2.0s
Memory limit: 98M
JAVA11 977M
Java 8 977M
Pypy 3 977M

Author:
Problem types
Allowed languages
Ada, Assembly, Awk, C, C++, C11, CLANG, CLANGX, Classical, COBOL, Coffee, CSC, D lang, DART, F95, FORTH, Fortrn, GAS32, GO, Haskell, Itercal, Java, kotlin, LEAN, LISP, LUA, MONOVB, Nasm, OCAML, Pascal, Perl, php, PIKE, prolog, Pypy, Python, Ruby 2, RUST, Scala, SCM, SED, SWIFT, TCL, TUR, V8JS, VB, ZIG

A nonnegative integer is considered adjacently distinct if all of its adjacent digits are different.

For example: \(102, 5310210, 102654\) are adjacently distinct while \(1022, 1455\) are not.

Given two (very large) nonnegative integers \(L\) and \(R\), your task is to count the number of adjacently distinct integers in range \([L, R]\).

Input

The first line contains digits of intger \(L\).

The second line contains digits of integer \(R\).

Output

The amount of adjacently distinct integers in range \([L, R]\).

Constraint

\(30\%\) points: \(L = 0, R = 10^k\) with \(k \le 18\).

\(30\%\) points: \(1 \le L \le R \le 10^{18}\).

\(40\%\) points: \(1 \le L \le R \le 10^{1000}\).

Example

Input:

0 20

Output:

20
QDUY

Comments

There are no comments at the moment.