class StringKumi { private int i,j; private int it,jt; private char []mojis; private int length; public StringKumi(String str) { i = 0; j = 0; it = 0; jt = 0; mojis = new char[str.length()+1]; for(int i= 0;i < str.length();i++) { mojis[i] = str.charAt(i); } length = str.length(); } private int getLength() { return this.length; } public String push_top() { int len = getLength(); if( jt < len) { jt++; } else { return null; } return new String(mojis,0,jt); } public String push() { int len = getLength(); if(j < len){ j++; }else{ if(i < len){ i++; j = i; }else{ return null; } } return new String(mojis,i,j-i); } public static void main(String args[]) { StringKumi test = new StringKumi("mosskite"); for(String A = test.push();A!=null;A = test.push()) { System.out.println(A); } System.out.println(test.push()); } }