Processing math: 100%
Compare substring - MarisaOJ: Marisa Online Judge

Compare substring

Time limit: 1000 ms
Memory limit: 256 MB
Given a string S=S1S2...Sn of length n that contains only digits. There are q queries, each of the form (a,b,l). Determine which number is greater S[a...a+l] or S[b...b+l]. ### Input - The first line contains a string S. - The second line contains an integer q. - The next q lines, each line contains 3 integers a,b,l, a query. ### Output - Print: + > if S[a...a+l] is greater than S[b...b+l]. + < if S[a...a+l] is smaller than S[b...b+l]. + = if S[a...a+l] is equal to S[b...b+l]. ### Constraints - 1≤|S|,q≤105. - 1≤a,b≤|S|. - a+l,b+l≤|S|. ### Example Input: 01392913461125270 Output: >\ <\ =