#C6433. Longest Unique Substring Queries
Longest Unique Substring Queries
Longest Unique Substring Queries
You are given a string and an integer denoting the number of queries. Each query is defined by two integers and , representing the range (1-indexed) within the string. For each query, consider the substring and determine the length of the longest substring within this segment that contains only unique characters.
The problem requires you to read input from standard input and print the answer for each query on a new line to standard output. Use efficient techniques (such as the sliding window algorithm) to solve the problem.
inputFormat
The input is provided via standard input in the following format:
- The first line contains the string .
- The second line contains an integer , the number of queries.
- Each of the next lines contains two space-separated integers and , representing a query.
It is guaranteed that .
outputFormat
For each query, output a single integer representing the length of the longest substring with all unique characters in the specified range. Each result should be printed on its own line via standard output.## sample
abcdea
3
1 5
2 4
1 6
5
3
5
</p>