题目描述
Problem Statement
Given is a string S consisting of X and ..
You can do the following operation on S between 0 and K times (inclusive).
- Replace a . with an X.
What is the maximum possible number of consecutive Xs in S after the operations?
Input
Input is given from Standard Input in the following format:
S
K
Output
Print the answer.
Constraints
- $1 \leq |S| \leq 2 \times 10^5$
- Each character of S is X or ..
- $0 \leq K \leq 2 \times 10^5$
- K is an integer.
Sample Input 1
XX...X.X.X.
2
Sample Output 1
5
After replacing the Xs at the 7-th and 9-th positions with X, we have XX...XXXXX., which has five consecutive Xs at 6-th through 10-th positions.
We cannot have six or more consecutive Xs, so the answer is 5.
Sample Input 2
XXXX
200000
Sample Output 2
4
It is allowed to do zero operations.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
XX...X.X.X.
2
样例输出
5