A Function to calculate the suffix hash Suffix hash is nothing but the prefix hash of the reversed string
static void computeSuffixHash ( String str , int n , int suffix [ ] , int power [ ] ) { suffix [ 0 ] = 0 ; suffix [ 1 ] = str . charAt ( n - 1 ) ; for ( int i = n - 2 , j = 2 ; i >= 0 && j <= n ; i -- , j ++ ) { suffix [ j ] = ( suffix [ j - 1 ] % MOD + ( str . charAt ( i ) % MOD * power [ j - 1 ] % MOD ) % MOD ) % MOD ; } return ; }