QOJ.ac

QOJ

时间限制: 3 s 内存限制: 256 MB 总分: 100

#7827. What's the difference

统计

A master craftsman decided to order nails from an online store. In the order form, he specified which nails he needed, entered the number $N$, filled in the remaining fields, and clicked the "Place Order" button. Immediately after this, a message appeared on the screen: "Order created with an error, $N$ contains $K$ extra digits." By the time he managed to call customer support, the order had already been assembled and shipped, but they could not tell him exactly how many nails were in the shipment. It is only known that the system received the number by discarding $K$ digits from the entered number $N$ in such a way that the result did not contain leading zeros. "Yes, and what is the difference, how many are there," they said over the phone.

Help the master craftsman calculate the maximum possible difference in the number of nails that could have been sent to him.

Input

The first line contains a single positive integer $N$ without leading zeros, $10 \leqslant N \leqslant 10^6$, the ordered number of nails.

The second line contains a single positive integer $K$, which is less than the number of digits in $N$.

Output

The first and only line contains a single non-negative integer — the maximum difference in the number of nails that could have been sent, without leading zeros.

Examples

Input 1

9052
2

Output 1

43

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.