Queries for characters in a repeated string | Print whether index i and j have same element or not ; Finding relative position of index i , j . ; Checking is element are same at index i , j ; Driver Code
function query ( s , i , j ) { let n = s . length ; i %= n ; j %= n ; if ( s [ i ] == s [ j ] ) document . write ( " " + " " ) ; else document . write ( " " + " " ) ; } let X = " " ; query ( X , 0 , 8 ) ; query ( X , 8 , 13 ) ; query ( X , 6 , 15 ) ;