Initialize a counter count to 0 for counting asterisks.
Initialize a boolean flag betweenBars to False.
Iterate through each character ch in the string s.
a. If ch is a vertical bar '|', toggle the betweenBars flag.
b. If ch is an asterisk '*' and betweenBars is False, increment the count.