Company: Texas
Difficulty: medium
Balanced Or Not? A string containing only `<` and `>` is balanced when every prefix has at least as many `<` as `>` and the total counts are equal. One replacement swaps an adjacent `><` into `<>`. For each string, determine whether it can be balanced using at most its given number of replacements. Print `1` if it can, otherwise `0`. Input Format The first line contains `T`. Each test case contains a string `S` and an integer `K` on the next line. Output Format Print one answer per test case.