diff options
Diffstat (limited to '')
-rw-r--r-- | 383/main.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/383/main.cpp b/383/main.cpp new file mode 100644 index 0000000..f7d4fa4 --- /dev/null +++ b/383/main.cpp @@ -0,0 +1,25 @@ + +#include "header.hpp" +#include <unordered_map> + +class Solution { +public: + static bool canConstruct(std::string ransomNote, std::string magazine) { + bool result; + + for (auto &iter : ransomNote) { + std::cout << iter; + auto pos = magazine.find(iter); + if (pos == std::string::npos) { + return false; + } else { + magazine[pos] = '\n'; + } + std::cout << magazine << "\n"; + } + + return true; + } +}; + +int main(int argc, char **argv) { Solution::canConstruct("maga", "magazine"); } |