aboutsummaryrefslogtreecommitdiffstats
path: root/383/main.cpp
blob: f7d4fa4ef3ffa4c8bdffe439c9b8b4f707dadcf7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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"); }