diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 21d35941..0ee8f307 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,6 +1,9 @@ # Code owners .github/CODEOWNERS @exercism/maintainers-admin +# The code sample shown in the code check when people sign up to Exercism +docs/SIGN_UP_SNIPPET.txt @exercism/maintainers-admin + # Changes to `fetch-configlet` should be made in the `exercism/configlet` repo bin/fetch-configlet @exercism/maintainers-admin bin/fetch-configlet.ps1 @exercism/maintainers-admin diff --git a/docs/SIGN_UP_SNIPPET.txt b/docs/SIGN_UP_SNIPPET.txt new file mode 100644 index 00000000..14bf57b3 --- /dev/null +++ b/docs/SIGN_UP_SNIPPET.txt @@ -0,0 +1,13 @@ +std::string most_common_word(const std::string& text) { + std::map counts; + std::string word, best; + std::istringstream words(text); + while (words >> word) { + for (char& c : word) c = std::tolower(c); + counts[word]++; + if (counts[word] > counts[best]) { + best = word; + } + } + return std::format("\"{}\" appears {} times", best, counts[best]); +}