Miss Me ?

5

1 votes
Easy
Problem

enter image description here

Moriarty is back with a chilling cryptic puzzle for Sherlock. The puzzle consists of 9 problems of varying difficulty. Sherlock must solve all the 9 problems to decrypt the hidden message of Moriarty.
Can you help him solve the problems ?

Problem 1

You are given a string consisting of digits and characters. Few of the numbers hiding between the characters are prime. Your task is to count the prime numbers(not necessarily distinct) in the string and also find the maximum prime among those. If there is no prime number in string , print -1 in place of maximum prime.

Input:

The first line of input contains an integer T denoting the number of test cases.

Each line of test case contains a string consisting of lowercase letters and digits.

Output:

For each test case, print two space separated integers, denoting the count all the primes and the maximum prime number in the string.

Constraints:

1T100

1 string length105

0 value of numbers in string107

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Test case 1: the numbers hiding in string are [4,2,7]. Count of primes: 2, Maximum prime: 7

Test case 2: the numbers hiding in string are [31,23,3,6]. Count of primes: 3, Maximum prime: 31

Editor Image

?