Skip to content

Commit

Permalink
Create 2315-Count-Asterisks.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitali-Matteo authored Aug 23, 2022
1 parent c8502c4 commit 668bdd0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cpp/2315-Count-Asterisks.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Solution{
public:
int countAsterisks(string s){
int NAst;
bool Coppia;
Coppia = false;
NAst = 0;
for(char & c : s){
if((c == '*') && (Coppia == false)){
NAst++;
}
if(c == '|'){
Coppia = !Coppia;
}
}
return NAst;
}
};

0 comments on commit 668bdd0

Please sign in to comment.