<p>A <strong>sentence</strong> is a string of single-space separated words where each word consists only of lowercase letters.</p>

<p>A word is <strong>uncommon</strong> if it appears exactly once in one of the sentences, and <strong>does not appear</strong> in the other sentence.</p>

<p>Given two <strong>sentences</strong> <code>s1</code> and <code>s2</code>, return <em>a list of all the <strong>uncommon words</strong></em>. You may return the answer in <strong>any order</strong>.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s1 = &quot;this apple is sweet&quot;, s2 = &quot;this apple is sour&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">[&quot;sweet&quot;,&quot;sour&quot;]</span></p>

<p><strong>Explanation:</strong></p>

<p>The word <code>&quot;sweet&quot;</code> appears only in <code>s1</code>, while the word <code>&quot;sour&quot;</code> appears only in <code>s2</code>.</p>
</div>

<p><strong class="example">Example 2:</strong></p>

<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">s1 = &quot;apple apple&quot;, s2 = &quot;banana&quot;</span></p>

<p><strong>Output:</strong> <span class="example-io">[&quot;banana&quot;]</span></p>
</div>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
	<li><code>1 &lt;= s1.length, s2.length &lt;= 200</code></li>
	<li><code>s1</code> and <code>s2</code> consist of lowercase English letters and spaces.</li>
	<li><code>s1</code> and <code>s2</code> do not have leading or trailing spaces.</li>
	<li>All the words in <code>s1</code> and <code>s2</code> are separated by a single space.</li>
</ul>

class Solution {
 public:
  static std::vector<std::string> uncommonFromSentences(
    const std::string_view s1, const std::string_view s2) {
    std::unordered_map<std::string_view, bool> checker;
    int start = 0;
    int far = 0;
    for (; far < s1.size(); ++far) {
      if (s1[far] != ' ') continue;
      std::string_view newWord = s1.substr(start, far - start);
      if (checker.find(newWord) != checker.end()) {
        checker[newWord] = true;
      } else {
        checker.emplace(newWord, false);
      }
      start = far + 1;
    }
    if (!s1.empty() && far - start > 0) {
      std::string_view newWord = s1.substr(start, far - start);
      if (checker.find(newWord) != checker.end()) {
        checker[newWord] = true;
      } else {
        checker.emplace(newWord, false);
      }
    }
    start = 0;
    far = 0;
    for (; far < s2.size(); ++far) {
      if (s2[far] != ' ') continue;
      std::string_view newWord = s2.substr(start, far - start);
      if (checker.find(newWord) != checker.end()) {
        checker[newWord] = true;
      } else {
        checker.emplace(newWord, false);
      }
      start = far + 1;
    }
    if (!s2.empty() && far - start > 0) {
      std::string_view newWord = s2.substr(start, far - start);
      if (checker.find(newWord) != checker.end()) {
        checker[newWord] = true;
      } else {
        checker.emplace(newWord, false);
      }
    }
    std::vector<std::string> ans;
    for (const auto [s, b] : checker) {
      if (!b) ans.emplace_back(s);
    }
    return ans;
  }
};

8300