public class StrDel {
	public static int strdel(char source[], char delStr[]) {
		int startIdx = 0;
		while (source[startIdx] != '\0') {
			int srchIdx = startIdx;
			int delIdx  = 0;
			while ((source[srchIdx] != '\0') && (delStr[delIdx] != '\0')) {
				if (source[srchIdx] != delStr[delIdx]) {
					break;
				}
				srchIdx++;
				delIdx++;
			}
			if (delStr[delIdx] == '\0') {
				// A match found. Remove the del str from the
				int destPos = startIdx;
				while (source[srchIdx] != '\0') {
					source[destPos] = source[srchIdx];
					destPos++;
					srchIdx++;
				}
				source[destPos] = '\0';
			} else {
				startIdx++;
			}
		}
		return startIdx;
	}

	public static void main(String args[]) {
		char source[] = new char[args[0].length() + 1];
		System.arraycopy(args[0].toCharArray(), 0, source, 0, args[0].length());
		source[args[0].length()] = '\0';

		char delStr[] = new char[args[1].length() + 1];
		System.arraycopy(args[1].toCharArray(), 0, delStr, 0, args[1].length());
		delStr[args[1].length()] = '\0';

		int length = StrDel.strdel(source, delStr);
		String s   = new String(source, 0, length);
		System.out.println("'" + s + "'");
	}
}
