Description
You are given a string s where pairs of pipes | enclose text. Return the number of asterisks * in s, excluding any that are between pairs of pipes.
Examples
Input:
s = "l|*e*et|c**o|*de|"Output:
2Explanation:
Only c** counted.
Input:
s = "iamprogrammer"Output:
0Explanation:
The string contains no pipe characters '|', so no stars are enclosed between pipes. The count is 0.
Input:
s = "*|hello*world|***coding|fun*|*"Output:
4Explanation:
The first * and last * are outside pairs. The ***coding section has 3 asterisks outside pairs (since |fun*| is a complete pair). Total: 1 + 3 = 4.
Constraints
- •
1 ≤ s.length ≤ 1000