Skip to content

Instantly share code, notes, and snippets.

@Loki-Astari
Created April 7, 2021 07:08
Show Gist options
  • Save Loki-Astari/5a8f945919d53da75c9a69f9facc1a5b to your computer and use it in GitHub Desktop.
Save Loki-Astari/5a8f945919d53da75c9a69f9facc1a5b to your computer and use it in GitHub Desktop.
#include <string>
#include <iostream>
int main()
{
std::string s;
std::getline(std::cin, s); // Should check that worked.
int q;
std::cin >> q;
for (int loop = 0; loop < q; ++loop) {
int a, b, l;
std::cin >> a >> b >> l;
std::string_view view_a(s);
view_a.remove_prefix(a);
view_a.remove_suffix(std::size(view_a) - l);
std::string_view view_b(s);
view_b.remove_prefix(b);
view_b.remove_suffix(std::size(view_b) - l);
std::cout << ((view_a == view_b) ? "Yes" : " No") << "\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment