#abc184b. B - Quizzes

B - Quizzes

Score : 200200 points

问题陈述

高桥将回答 NN 个测验问题。 最初,他有 XX 分。每次他回答问题,如果回答正确,他将获得 11 分;如果回答错误,他将失去 11 分。 然而,有一个例外:当他有 00 分时,回答错误的问题不会失去分数。

你将得到一个字符串 SS,表示高桥的答案是否正确。 如果从左边数第 ii 个字符是 o,则意味着他第 ii 个问题的答案正确;如果那个字符是 x,则意味着他第 ii 个问题的答案错误。 最后他将有多少分?

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

Takahashi will answer NN quiz questions.
Initially, he has XX points. Each time he answers a question, he gains 11 point if his answer is correct and loses 11 point if it is incorrect.
However, there is an exception: when he has 00 points, he loses nothing for answering a question incorrectly.

You will be given a string SS representing whether Takahashi's answers are correct.
If the ii-th character of SS from the left is o, it means his answer for the ii-th question is correct; if that character is x, it means his answer for the ii-th question is incorrect.
How many points will he have in the end?

Constraints

  • 1N2×1051 \le N \le 2 \times 10^5
  • 0X2×1050 \le X \le 2 \times 10^5
  • SS is a string of length NN consisting of o and x.

Input

Input is given from Standard Input in the following format:

NN XX

SS

Output

Print the number of points Takahashi will have in the end.

Sample Input 1

3 0
xox

Sample Output 1

0

Initially, he has 00 points.
He answers the first question incorrectly but loses nothing because he has no point.
Then, he answers the second question correctly, gains 11 point, and now has 11 point.
Finally, he answers the third question incorrectly, loses 11 point, and now has 00 points.
Thus, he has 00 points in the end. We should print 00.

Sample Input 2

20 199999
oooooooooxoooooooooo

Sample Output 2

200017

Sample Input 3

20 10
xxxxxxxxxxxxxxxxxxxx

Sample Output 3

0