CodeLab Academy 📞 9936 6696
← List Python · Level 10: Algorithms Code · 100 points ← #964 #966 →

#965. Longest run of 1s with k flips

You get a list of 0s and 1s and k. You may change at most k zeros into 1s. Find the length of the longest run of 1s next to each other. ### Input The first line has n, the second line has n integers separated by spaces. The third line has k. ### Output A number.

Examples

Input
3
1 1 0
3
Output
3
Input
2
0 0
3
Output
2

💡 You can solve it with Python, JavaScript or blocks. Read the input line by line with input(). Don't print a question (like input("Number: ")). Print exactly what the output asks for, nothing more.

🔒 You can solve the first 3 problems without an account. Sign up for free to solve this one!