Skip to content

Commit

Permalink
Minor logic error
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Sep 11, 2024
1 parent 6adeba8 commit 100ca83
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cplusplus/src/p0017.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ std::string ToString(uint64_t n) {
uint64_t EMSCRIPTEN_KEEPALIVE p0017() {
uint64_t answer = 0;
std::string filter[2] = {" ", "-"};
size_t pos, i;
size_t pos = 0, i;
for (uint32_t x = 1; x < 1001; x += 1) {
std::string str = ToString(x);
for (pos = 0, i = 0; i < 2; i++)
for (i = 0; i < 2; pos = 0, i++)
while ((pos = str.find(filter[i], pos)) != std::string::npos)
str.replace(pos, 1, "");

Expand Down

0 comments on commit 100ca83

Please sign in to comment.