Barcode Number - Old ID

Barcode Number - Old ID - WIPRO 

Problem:

The program must accept an integer representing a barcode number of a product containing cosmetics. Each digit in the barcode number represents the ID of the cosmetic item. The oldest cosmetic item is the one with the smallest ID. There can be multiples of the same cosmetic item in the product. The program must print the ID of the oldest cosmetic item in the given product as the output. 

Boundary Condition(s): 

1 <= N <= 10^8 

Input Format: 

The first line contains an integer representing a barcode number of a product containing cosmetics. 

Output Format: 

The first line contains an integer representing the ID of the oldest cosmetic item in the given product. 

Example Input/Output 1: 

Input: 

32957 

Output: 

Explanation: 

Here N = 32957. The smallest ID in 32957 is 2. So it is printed as the output. 

Example Input/Output 2: 

Input: 

98575 

Output: 

5

Program:

s = list(input().strip())

print(min(s))

Comments

Popular posts from this blog

Pronic Integers in N - InfyTQ question

Count Strong Points - Accenture

Letters at position of multiples of a number