题目
思路
解答
class Solution {
public:
int countAsterisks(string s) {
int length = s.length();
int line = 0;
int num = 0;
for(int i = 0; i < length; i++)
{
if(s[i] == '|')
{
line = line + 1;
}
else if(line % 2 == 0)
{
if(s[i] == '*') num++;
}
}
return num;
}
};
标签:星号,2315,++,int,length,num,line,LeetCode
From: https://www.cnblogs.com/zjacky/p/17071796.html