<awangdev>293. Flip Game_2.java
public List<String> generatePossibleNextMoves(String s) {
        List<String> rst = new ArrayList<String>();
        if (s == null || s.length() == 0) {
            return rst;
        }
        ArrayList<Integer> list = new ArrayList<Integer>();
        StringBuffer sb = new StringBuffer(s);
        while (sb.indexOf("++") != -1) {
            int index = sb.indexOf("++");
            list.add(index);
            sb.replace(index, index + 1, "*");
        }
        for (int index : list) {
            rst.add(s.substring(0, index) + "--" + s.substring(index + 2));
        }
        return rst;
    }
public List < String > var_1 ( String var_2 ) {
  List < String > var_5 = new ArrayList < String > ( ) ;
  if ( var_2 == null || var_2 . length ( ) == 0 ) {
    return var_5 ;
  }
  ArrayList < Integer > var_10 = new ArrayList < Integer > ( ) ;
  StringBuffer var_12 = new StringBuffer ( var_2 ) ;
  while ( var_12 . indexOf ( "++" ) != - 1 ) {
    int var_16 = var_12 . indexOf ( "++" ) ;
    var_10 . add ( var_16 ) ;
    var_12 . replace ( var_16 , var_16 + 1 , "*" ) ;
  }
  for ( int var_16 : var_10 ) {
    var_5 . add ( var_2 . substring ( 0 , var_16 ) + "--" + var_2 . substring ( var_16 + 2 ) ) ;
  }
  return var_5 ;
}
