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:2
Explanation:

Only c** counted.

Input:s = "iamprogrammer"
Output:0
Explanation:

The string contains no pipe characters '|', so no stars are enclosed between pipes. The count is 0.

Input:s = "*|hello*world|***coding|fun*|*"
Output:4
Explanation:

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

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!