Implemented function to remove duplicate characters without using any additonal structures