SCC - Seminole Community CollegeGo to your search results
AdmissionsDegrees and ProgramsCampus LifeContact UsFrequently Asked QuestionsMySCCQuick LinksFuture Students Navigational Options Duplicates Programming Problem

Delete Duplicates Computer Programming Problem


Problem Description

Create an application that removes duplicate entries from a list of numbers. Your application will process a maximum of 20 integer numbers. Each number will be equal to or greater than zero. You do not need to edit for floating point numbers or invalid characters. Twenty is the maximum number of values to be entered. The user must be able to enter 0 numbers, 1 number, 20 numbers or any amount between 1 and 20. If you create a command line application, allow the user to enter -1 to indicate no more numbers will be entered. Once the input is complete, the application must indicate which numbers are duplicated and how many duplicates existed for each number.

Input

Input will be a series of integers separated by at least one space. Any number of integers from 0 to 20 may be entered. The user must be able to enter 0 numbers, 1 number, 20 numbers or any other count of numbers between 0 and 20 inclusive. You do not need to edit to ensure only numbers are entered. Only integer numbers will be entered.

Your values may be input as a single set of data or as a grouping of individual pieces of data. Your application can be created to process a single set of data. That is, after processing a set of data, your application can end. You can then start the application again and enter a second set of data. If you use a graphical interface (Visual Basic, C#, ...) you can enter the data in text boxes and display the results in text boxes or labels. However, a graphical interface is not required for this application. If you create a command line application you can prompt for the input numbers one at a time or enter them all in a single input statement.

Ouput

Print the original list of numbers entered. Next print a listing of any number that was duplicated and the number of duplicates. Finally print the revised list of numbers minus any duplicates.

Sample Input/Output

The last row in the table above indicates that no values were entered.

Input Output
1 2 3 4 5 1 6 1 7 1 8 1 9 1 10 -1 1 2 3 4 5 1 6 1 7 1 8 1 9 1 10

Value 1: 5 copies are deleted

1 2 3 4 5 6 7 8 9 10
1 2 1 2 1 2 1 2 3 4 5 3 -1 1 2 1 2 1 2 1 2 3 4 5 3

Value 1: 3 copies are deleted

Value 2: 3 copies are deleted

Value 3: 1 copies are deleted

1 2 3 4 5
23 23 23 23 23 23 23 -1 23 23 23 23 23 23 23

Value 23: 6 copies are deleted

23
8 7 33 19 22 57 -1 8 7 33 19 22 57

No duplicate values

8 7 33 19 22 57
18 -1 18

No duplicate values

18
-1No duplicate values
Want more information?

Melinda White
Program Manager
Phone: 407.708.2447
Fax: 407.708.2322
Office: V102-I
whitemc@scc-fl.edu

Get Admissions Info
or call 407.708.2050

Did you know?

SCC's computer programs prepare both students and professionals for certification exams.