fork download
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main() {
  6. string s;
  7. int q, begin1, end1, begin2, end2;
  8. getline(cin, s);
  9. cin >> q;
  10. while (q--) {
  11. cin >> begin1 >> end1 >> begin2 >> end2;
  12. end1 -= --begin1;
  13. end2 -= --begin2;
  14. cout << (s.substr(begin1, end1) == s.substr(begin2, end2) ? '+' : '-');
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0s 15240KB
stdin
abacaba
4
1 1 7 7
1 3 5 7
3 4 4 5
1 7 1 7
stdout
++-+