{"trustable":true,"sections":[{"title":"","value":{"format":"MD","content":"\u003ch3\u003e Read problems statements in \u003ca target\u003d\"_blank\" href\u003d\"https://www.codechef.com/download/translated/SNCK15EL/mandarin/ANKPAL.pdf\"\u003eMandarin Chinese \u003c/a\u003e , \u003ca target\u003d\"_blank\" href\u003d\"https://www.codechef.com/download/translated/SNCK15EL/russian/ANKPAL.pdf\"\u003eRussian\u003c/a\u003e and \u003ca target\u003d\"_blank\" href\u003d\"https://www.codechef.com/download/translated/SNCK15EL/vietnamese/ANKPAL.pdf\"\u003eVietnamese\u003c/a\u003e\u003c/h3\u003e\r\n\r\n\r\n\r\n\u003cp\u003eMark has recently started studying string algorithms. So, as to gauge his knowledge, Lucy challenges him to a task.\u003c/p\u003e\r\n\u003cp\u003e\"Given a string \u003cstrong\u003es\u003c/strong\u003e, answer several times a query to determine whether a \u003cem\u003esubstring\u003c/em\u003e \u003cstrong\u003es[i, j]\u003c/strong\u003e (inclusive) is palindromic or not.\", said Lucy in a confident tone!\u003c/p\u003e\r\n\u003cp\u003eAs smart as Mark is, he was able to instantly find the solution!\u003c/p\u003e\r\n\u003cp\u003eNow, Mark has challenged little Lucy to do the same task by reversing a specific substring beforehand. As Lucy is still just a novice, she asks for your help.\u003c/p\u003e\r\n\u003cp\u003eYou have to write a program that answers \u003cstrong\u003eQ\u003c/strong\u003e queries on a string \u003cstrong\u003eS\u003c/strong\u003e.\u003c/p\u003e\r\n\u003cp\u003eEach query contains four integers (\u003cstrong\u003ei\u003c/strong\u003e, \u003cstrong\u003ej\u003c/strong\u003e, \u003cstrong\u003ek\u003c/strong\u003e, \u003cstrong\u003el\u003c/strong\u003e).\r\nFor every query, first reverse the \u003cem\u003esubstring\u003c/em\u003e \u003cstrong\u003es[i, j]\u003c/strong\u003e (inclusive) and then report if \u003cem\u003esubstring\u003c/em\u003e \u003cstrong\u003es[k, l]\u003c/strong\u003e (inclusive) is a palindrome.\u003c/p\u003e\r\n\u003cp\u003eNote that the reversal operations are only for the specific query and should not persist for further queries. Please check the explanation section for better understanding.\u003c/p\u003e\r\n\u003ch3\u003eInput:\u003c/h3\u003e\r\n\u003cp\u003eThe first line of input file contains string \u003cstrong\u003eS\u003c/strong\u003e. The next line contains an integer \u003cstrong\u003eQ\u003c/strong\u003e.\u003cbr /\u003e\r\nEach of the following \u003cstrong\u003eQ\u003c/strong\u003e lines each contain 4 space separated integers \u003cstrong\u003ei, j, k and l.\u003c/strong\u003e\u003c/p\u003e\r\n\u003ch3\u003eOutput:\u003c/h3\u003e\r\n\u003cp\u003eOutput exactly \u003cem\u003eQ\u003c/em\u003e lines, each containing the result of corresponding query as \u003cem\u003e\"Yes\"\u003c/em\u003e or \u003cem\u003e\"No\"\u003c/em\u003e.\u003c/p\u003e\r\n\u003ch3\u003eConstraints:\u003c/h3\u003e\r\n\u003cstrong\u003e\r\n\u003cul\u003e\r\n\u003cli\u003e1 ≤ |S| ≤ 10\u003csup\u003e5\u003c/sup\u003e \r\n\u003c/li\u003e\r\n\u003cli\u003e1 ≤ Q ≤ 333333\r\n\u003c/li\u003e\r\n\u003cli\u003e1 ≤ i ≤ j ≤ |S| \r\n\u003c/li\u003e\r\n\u003cli\u003e1 ≤ k ≤ l ≤ |S|\u003c/li\u003e\r\n\u003cli\u003eS contains only the characters \u0027a\u0027 to \u0027z\u0027\u003c/li\u003e\r\n\u003c/ul\u003e\r\n\u003c/strong\u003e\r\n\u003ch3\u003eExample:\u003c/h3\u003e\r\n\u003cp\u003e\u003cstrong\u003eSample Input:\u003c/strong\u003e\u003c/p\u003e\r\n\u003cpre\u003e\r\nababa\r\n4\r\n2 3 3 4\r\n1 2 3 4\r\n1 3 3 5\r\n2 4 1 5\r\n\r\n\u003c/pre\u003e\r\n\u003cp\u003e\u003cstrong\u003eSample Output:\u003c/strong\u003e\u003c/p\u003e\r\n\u003cpre\u003e\r\nYes\r\nNo\r\nYes\r\nYes\r\n\u003c/pre\u003e\r\n\u003ch3\u003eExplanation:\u003c/h3\u003e\r\n\u003cp\u003e\u003cstrong\u003eQuery 1:\u003c/strong\u003e\r\nThe string becomes a\u003cstrong\u003eab\u003c/strong\u003eba. The queried substring is \u003cem\u003ebb\u003c/em\u003e, which is a palindrome.\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003eQuery 2:\u003c/strong\u003e\r\nThe string becomes \u003cstrong\u003eba\u003c/strong\u003eaba. The queried substring is \u003cem\u003eab\u003c/em\u003e, which is not a palindrome.\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003eQuery 3:\u003c/strong\u003e\r\nThe string becomes \u003cstrong\u003eaba\u003c/strong\u003eba. The queried substring is \u003cem\u003eaba\u003c/em\u003e, which is a palindrome.\u003c/p\u003e\r\n\u003cp\u003e\u003cstrong\u003eQuery 4:\u003c/strong\u003e\r\nThe string becomes a\u003cstrong\u003ebab\u003c/strong\u003ea. The queried substring is \u003cem\u003eababa\u003c/em\u003e, which is a palindrome.\u003c/p\u003e\r\n\u003ch3\u003eNotes:\u003c/h3\u003e\r\n\u003cul\u003e\r\n\u003cli\u003eHere, a substring [i, j] is defined as the string formed by characters s[i], s[i+1],..., s[j].\u003c/li\u003e\r\n\u003cli\u003eA palindrome is a sequence of characters which reads the same backward or forward. For example, \u003cstrong\u003eaba\u003c/strong\u003e, \u003cstrong\u003eabba\u003c/strong\u003e are palindromes, while \u003cstrong\u003eabab\u003c/strong\u003e and \u003cstrong\u003eabcd\u003c/strong\u003e are not palindromes.\u003c/li\u003e\r\n\u003c/ul\u003e"}}]}