Ask Question
27 February, 14:01

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. 27 February, 15:18
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers