import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;


public class BRFilter extends FilterOutputStream {
	String temp = "";
	public BRFilter(OutputStream out){
		super(out);
	}
	
	public void write(int b)throws IOException{
		if(b == 92){
			temp = temp + (char)b;
		}
		if(b == 110){
			if(temp.equals("")){
				out.write(b);
			}else{
				out.write('<');
				out.write('b');
				out.write('r');
				out.write('>');
				temp = "";
			}
		}else{
			if(temp.equals("")) out.write(b);
			else{
				out.write(92);
				out.write(b);
				temp = "";
			}
		}
	}
	
	public void write(byte[] b) throws IOException{
		int i;
		for(i=0; i<b.length; i++){
			write(b[i]);
		}
	}
	
	public void write(byte[] b, int off, int len) throws IOException{
		int i;
		for(i=off; i<off+len; i++){
			write(b[i]);
		}
	}
}
