static String[] DefPrefixes(String prefix){
  if (prefix.equals("")) {
    return new String[]{""};
  }
  String[] split=prefix.split("!");
  String[] result=new String[split.length + 1];
  for (int i=0; i < result.length; i++) {
    if (i == 0) {
      result[i]="";
    }
 else {
      result[i]=result[i - 1] + split[i - 1];
    }
    if (i != 0) {
      result[i]=result[i] + "!";
    }
  }
  return result;
}

static String [ ] DefPrefixes ( String prefix ) { if ( prefix . equals ( "" ) ) { return new String [ ] { "" } ; } String [ ] split = prefix . split ( "!" ) ; String [ ] result = new String [ split . length + 1 ] ; for ( int i = 0 ; i < result . length ; i ++ ) { if ( i == 0 ) { result [ i ] = "" ; } else { result [ i ] = result [ i - 1 ] + split [ i - 1 ] ; } if ( i != 0 ) { result [ i ] = result [ i ] + "!" ; } } return result ; }
if prefix = " foo ! bar ! " , then it returns the three - element array [ " " , " foo ! " , " foo ! bar ! " ] .
