/*
* @lc app=leetcode.cn id=2315 lang=typescript
*
* [2315] 统计星号
*/
// @lc code=start
function countAsterisks(s: string): number {}
// @lc code=end
function countAsterisks(s: string): number {
let flag = false,
res = 0
for (let ch of s) {
if (!flag && ch === '*') res++
if (ch === '|') flag = !flag
}
return res
}
test.each([
{ input: { s: 'l|*e*et|c**o|*de|' }, output: 2 },
{ input: { s: 'iamprogrammer' }, output: 0 },
{ input: { s: 'yo|uar|e**|b|e***au|tifu|l' }, output: 5 },
])('input: s = $input.s', ({ input: { s }, output }) => {
expect(countAsterisks(s)).toEqual(output)
})