From 56bace58b721ee00998fdf46861ec6c714477ace Mon Sep 17 00:00:00 2001 From: Lam Haoyin Date: Thu, 7 Apr 2022 02:02:04 +0800 Subject: [PATCH] fix: redundant variable --- cpp/2204/220407-CN.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cpp/2204/220407-CN.cpp b/cpp/2204/220407-CN.cpp index 0b35581..66bd9e9 100644 --- a/cpp/2204/220407-CN.cpp +++ b/cpp/2204/220407-CN.cpp @@ -13,8 +13,7 @@ public: return true; }; - std::size_t pos = 0; - for (std::size_t nextPos = goal.find(ch, pos); nextPos != std::string::npos; nextPos = goal.find(ch, pos = nextPos + 1)) + for (std::size_t nextPos = goal.find(ch, 0); nextPos != std::string::npos; nextPos = goal.find(ch, nextPos + 1)) if (verify(nextPos)) return true; return false;