1- Largest Prime

2

1 votes
Problem

Given a number. Tell the largest prime that can be formed by removing some digits from front and back of that number

eg-21342 || largest prime=13 (by removing 2 from front and 42 from back)

eg-197 ||largest prime=197(remove nothing from front and back)

Note-if there exist no prime number print "0"

eg- 44 || ans=0 as there exist no prime number

INPUT FORMAT- Input is of only one line containing a number

OUTPUT FORMAT- output is the largest prime formed by removing Digits from back and front

Sample Input-

22173264

Sample Output-

173

Time Limit: 5
Memory Limit: 256
Source Limit:
Contributers:
Editor Image

?