public String minWindow(String S, String T) {
          if(T.length() == 0) return "";
    	  int lastBeginIndex = -1;
    	  String res = "";
    	  for(int i=0,j=0; i<S.length(); i++)
    	  {
    		  if(S.charAt(i) == T.charAt(j))
    		  {
    			  j++;
    			  if(j==1)lastBeginIndex = i;
    				  
    			  if(j==T.length())
    			  {
    				  
    				  j=0;
    				  String sub = S.substring(lastBeginIndex, i+1);
    				  res = sub.length() < res.length() || res.length()==0 ? sub:res;
    			  }
    		  }
    	  }
          
    	  return res;
      }