#B2145. Extract Kth Digit from the Right

    ID: 11227 Type: Default 1000ms 256MiB

Extract Kth Digit from the Right

Extract Kth Digit from the Right

Define a function \(digit(n,k)\) that extracts the \(k\)th digit from the right in the integer \(n\). For example, for \(n = 12345\) and \(k = 1\), the output should be 5; and for \(k = 3\), the output should be 3.

inputFormat

The input consists of two space-separated integers: \(n\) and \(k\). It is guaranteed that \(k\) is a valid digit position in \(n\) (i.e. \(1 \le k \le\) the number of digits in \(n\)).

outputFormat

Output the \(k\)th digit from the right of \(n\).

sample

12345 1
5