comefrom: <gouthampradhan>two_pointers_LastSubstringInLexicographicalOrder_1.java
code: public String lastSubstring(String s) {
      int currAns = 0;
      int candidate = -1;
      int prevIndex = 1;
      for (int i = 1, l = s.length(); i < l; i++) {
        if (candidate != -1) {
          if (s.charAt(i) == s.charAt(prevIndex)) {
            prevIndex++;
          } else if (s.charAt(i) > s.charAt(prevIndex)) {
            if (s.charAt(i) > s.charAt(candidate)) {
              currAns = i;
              candidate = -1;
              prevIndex = currAns + 1;
            } else if (s.charAt(i) == s.charAt(candidate)) {
              currAns = candidate;
              candidate = i;
              prevIndex = currAns + 1;
            } else {
              currAns = candidate;
              candidate = -1;
              prevIndex = currAns + 1;
            }
          } else {
            candidate = -1;
            prevIndex = currAns + 1;
          }
        } else {
          if (s.charAt(i) > s.charAt(currAns)) {
            currAns = i;
            candidate = -1;
            prevIndex = currAns + 1;
          } else if (s.charAt(i) == s.charAt(currAns)) {
            candidate = i;
          }
        }
      }
      return s.substring(currAns);
    }
masked: public String var_0 ( String var_1 ) {
    int var_2 = 0 ;
    int var_3 = - 1 ;
    int var_4 = 1 ;
    for ( int var_5 = 1 , var_6 = var_1 . length ( ) ;
    var_5 < var_6 ;
    var_5 ++ ) {
      if ( var_3 != - 1 ) {
        if ( var_1 . charAt ( var_5 ) == var_1 . charAt ( var_4 ) ) {
          var_4 ++ ;
        }
        else if ( var_1 . charAt ( var_5 ) > var_1 . charAt ( var_4 ) ) {
          if ( var_1 . charAt ( var_5 ) > var_1 . charAt ( var_3 ) ) {
            var_2 = var_5 ;
            var_3 = - 1 ;
            var_4 = var_2 + 1 ;
          }
          else if ( var_1 . charAt ( var_5 ) == var_1 . charAt ( var_3 ) ) {
            var_2 = var_3 ;
            var_3 = var_5 ;
            var_4 = var_2 + 1 ;
          }
          else {
            var_2 = var_3 ;
            var_3 = - 1 ;
            var_4 = var_2 + 1 ;
          }
        }
        else {
          var_3 = - 1 ;
          var_4 = var_2 + 1 ;
        }
      }
      else {
        if ( var_1 . charAt ( var_5 ) > var_1 . charAt ( var_2 ) ) {
          var_2 = var_5 ;
          var_3 = - 1 ;
          var_4 = var_2 + 1 ;
        }
        else if ( var_1 . charAt ( var_5 ) == var_1 . charAt ( var_2 ) ) {
          var_3 = var_5 ;
        }
      }
    }
    return var_1 . substring ( var_2 ) ;
  }
  