All Tracks Problem

Joey Tribbiani
Tag(s):

Easy

Problem
Editorial
Analytics

Joey Tribbiani

enter image description here

Joey, who calls himself as "actor-slash-model" has not been doing so well in the movies lately. The movie director these days are asking a lot of questions to Joey before signing him up.

After many auditions he is at last step for getting the role he has been desiring for Dr. Drake Ramoray. But knowing him as he is, He asks for your help to help him land the chance for his lifetime by solving this challenging problem ( challenging for Joey, its cakewalk for you guys).

The director is crazy for palindromes and loves to make them a lot. He first gives to Joey the name of a movies S which is more often than not a long one for testing Joeys speed, and then asks him Q queries of the form [L R]. For each query joey is supposed to tell whether or not he will be able to make a palindrome of the substring by just rearranging the letters of the movie name from L to R.

Can you Help ?

Input:

The first line of input contain a string S, of lowercase characters.
Next line contains an integer Q - number of queries.
Each of the next Q lines contain two integers L R.

Output:

For each query output 'Yes' or 'No'.

Constraints:

\( 1 \leq |S| \leq 10^{5} \)

\( 1 \leq Q \leq 10^{5} \)

\( 1 \leq L \leq R \leq |S| \)

Problem Setter - Saurabh

SAMPLE INPUT
aabbcdc
2
1 4
5 6
SAMPLE OUTPUT
Yes
No
Explanation

For query 1- In the given input index 1 to 4 consists of 'aabb' , which can be rearranged to abba, therefore Yes.

For query 2- Index 5 to 6 is 'cd', which can not be rearranged to a palindrome.

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), TypeScript, Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

CODE EDITOR

Initializing Code Editor...
Your Rating:
Notifications
View All Notifications

?