fork download
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int main() {
  6. char str[100001], substr1[100001], substr2[100001];
  7. cin >> str;
  8. int q, l1, r1, l2, r2;
  9. cin >> q;
  10. while (q--) {
  11. cin >> l1 >> r1 >> l2 >> r2;
  12. strncpy(substr1, &str[l1 - 1], r1 - l1 + 1);
  13. strncpy(substr2, &str[l2 - 1], r2 - l2 + 1);
  14. cout <<( strcmp(substr1,substr2) == 0 ? '+': '-');
  15. memset(substr1, 0, sizeof(substr1)/sizeof(substr1[0]));
  16. memset(substr2, 0, sizeof(substr2)/sizeof(substr2[0]));
  17.  
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 15408KB
stdin
qwertyqwerty
5
1 3 7 9
4 5 10 11
1 3 5 7
7 8 3 4
4 4 10 10
stdout
++--+