F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Palindrome

Time Limit: 10000/6000 MS (Java/Others)    Memory Limit: 125536/65536 K (Java/Others)
Total Submission(s): 632    Accepted Submission(s): 3


Problem Description
Given a string S,you are asked to find the longest palindrome in the substring [l,r].
 

Input
The first line is a number T which indicates the number of test cases

then follows a string s(length(s)<200000)
s can consists all ascii characters
Then an integer q,q querys(q<200000)
each query is two integer l,r.
find the longest palindrome in the substring [l,r].
 

Output
the answer for each query.
 

Sample Input
1 aaabbcc 5 1 7 1 4 2 3 4 5 2 5
 

Sample Output
3 3 2 2 2
 

Hint
1 7 means aaabbcc the longest palindrome substring is aaa,whose length is 3.
4 5 means bb the longest palindrome substring is bb,whose length is 2.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-27 04:39:00, Gzip enabled