import java.io.*;

public class problem1 {

    public static void main (String args[]) throws java.io.IOException {
	
		// to read easily from the keyboard
		BufferedReader br = new BufferedReader (new InputStreamReader(System.in)); 

		// print out welcome message
        System.out.println("Welcome to the no-repeat protocol concept program.");
        System.out.println("Type 'quit' to exit the program.");
		
		// query input
		System.out.println("\nInput to clear:");
		String input = br.readLine();
		
		// as long as the input is different from "quit"
		while(! input.equals("quit")) {
		
			// if the input isn't empty
			if (input.length() > 0)
			{
				// the first character will always be printed
				// this is why we tested input.length( ) > 0
				System.out.print(input.charAt(0));
				
				// scan through each character of the string until the end
				for (int i = 1; i < input.length(); i++) {
					// compare the current character to the previous one
					// because we compare to previous character we start our
					// index i at 1, which is why we took the output of
					// the character 0 out of the loop, forcing us to check 
					// that the string isn't empty
					if (input.charAt(i) != input.charAt(i-1))
						// if characters are equal then print current character
						System.out.print(input.charAt(i));	
					// implicitly, characters that are equal to the previous
					// one are ignored
				}	
			}
		
			// ask for the next input before looping back and check for "quit"
			System.out.println("\n\nInput to clear:");
			input = br.readLine();
		}
    }
}
