Ask Question
20 October, 02:28

You're given a sequence of non-negative numbers on a single line via standard input, each separated by a single space. Print the same list with on a single line on standard output however after removing any element that occurs only once.

Assumptions

1. All the numbers are non-negative (greater than or equal to 0.

2. The only input is the sequence of numbers

3. There are no punctuation marks or anything else to worry about reading.

4. There's at least one number in the sequence which occurs more than once

Example

input 2313

Answer 1313

+5
Answers (1)
  1. 20 October, 03:58
    0
    We have the following code in Python below with appropriate comments

    Explanation:

    values = input (). split () #splitting the standard input

    lst = [] #creating an empty list

    for number in values:

    if values. count (number) > 1: #conditional statement for only considering

    #numbers which occur more than once

    lst. append (number) #adding the number into the empty list

    print (' '. join (lst)) #displays the result
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “You're given a sequence of non-negative numbers on a single line via standard input, each separated by a single space. Print the same list ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers