text contains lowercase English letters, asterisks * and vertical bars |. The bars pair up in order: the first with the second, the third with the fourth, and so on. Everything between the two bars of a pair is fenced off. If the number of bars is odd, the last bar has no partner, and everything from it to the end of the string is fenced off.
Return the number of asterisks * that are not fenced off by any pair.text="a*b|**|c*" → 2
The two stars inside the first pair of | are skipped; the ones after a and after c remain, 2 in total.
text="|*|*|*|" → 1
The bars pair up as 1–2 and 3–4. Each pair fences one star, and the single star between the pairs counts.
text="stars" → 0
There are no stars at all, so the answer is 0.
text consists of lowercase English letters, * and |text="a*b|**|c*"
2
Run checks the first 3 tests in your browser. Submit checks all 107 tests on the server, hidden ones included.