Skip to content

Commit

Permalink
Bug fixes for fa.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
aarikpokras authored Dec 1, 2024
1 parent a16d600 commit 5e9727e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/fa.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ size_t find_a(string str) {
size_t amt = 0;
while (str.length() != 0) {
size_t index = str.find(",");
amt++;
str.erase(0, index+1);
if (index == string::npos) {
if (index > str.size()) {
amt++;
return amt;
str.erase(0, str.size());
} else {
amt++;
str.erase(0, index+1);
}
}
return amt;
Expand Down

0 comments on commit 5e9727e

Please sign in to comment.