Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 2 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 17 Sep 2017 My Price 9.00

T denoting number

You are given a sequence of N integers, a[1], a[2], , , , a[N].
Find out the maximum possible average value of sub-sequences of array a.

Input

First line of the input contains a single integer T denoting number of test cases

For each test case, first line contains a single integer denoting N, the number of elements of array a.
Next line contains N space separated integers denoting the array a.

Output

Print T lines each line containing the maximum possible average value. Your answer will be considered correct if it's absolute or relative error is less than 10 -6.

Constraints

  • 1 = T = 10
  • 2 = N = 1000
  • 1 = A[i] = 10^5

Example

Input: 1 5 1 3 2 1 3 Output: 3

Explanation

Example case 1. Average value of subsequence 3, 3 is 3. This is the maximum possible average value.

q2

Awesomeness of a string is defined by a pair of a character C and an integer F, satisfying the following conditions :

  • C must belong to the given string S and there must be a substring subS of S having length equal to F such that all the characters in subS are equal to c.
  • F should be as large as possible.

Your aim is to maximize the value of F. If there are more than one c whose maximum F value is same than you need to chose the character c
with minimum ascii value.

For example let’s take S = abbbaaabad. subS is written in bold.

  1. Take c = ‘a’ :
    Maximum possible F value is 3 (abbbaaabad).
  2. Take c = ‘b’:
    Maximum possible F value is 3 (abbbaaabad).
  3. Take c = ‘d’:
    Maximum possible F value is 1 (abbbaaabad).

So that awesomeness of abbbaaabad is defined by c = ‘a’ and F = 3. First priority is to maximize the value of F (we prefered 3 over 1).
If there are more than one c whose maximum F value is same then we prefer the c with minimum ascii value (we prefered ‘a’ over ‘b’).

You will be given a string and you need to find its awesomeness.

Input

Only line of the input will contain a string S.

Output

Output two lines. First line should contain value of c, whereas second line should contain value of F.

Constraints

  • 1 = length of string S = 10^5
  • S contains only lowercase alphabets of English Language (i.e. from 'a' to 'z').

Example

Input: abbbaaabad Output: a 3

Explanation

Example case 1. Example taken from problem statement

Answers

(5)
Status NEW Posted 17 Sep 2017 12:09 PM My Price 9.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)