Write a Java program that reads in a sequence of integers and prints out the integers, removing
Fantastic news! We've Found the answer you've been seeking!
Question:
Write a Java program that reads in a sequence of integers and prints out the integers, removing repeated values that appear consecutively. Assume that the input ends with I. For example, if the input is 1 2 2 1 5 1 17 7 7 7 1 1 1 1 1 1 1 1 1 !, your program should print out 1 2 1 5 1 7 1. Below is a sample run:
Enter a sequence of positive integers (! to end the input): 1 2 2 1 4 5 7 7 2 ! 1 2 1 4 5 7 2
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date: