Beruflich Dokumente
Kultur Dokumente
Input format
------------
First, you will be given a positive integer N <= 100 which indicates
the number of elements in the array.
Then you will be given a starting index s and and an end index e. You
can assume that 0 <= s <= e <= N-1.
Output format
-------------
You have to print the maximum element in the subarray starting with
index s, and ending with index e, both indices included.
Question 2
Due on 2017-09-17, 13:00 IST
You are the encoded form of a data string as follows: consecutive
occurrences of a letter (up to 9) are represented by the letter
followed by the number of occurrences.
a9a3b2c4de
aaaaaaaaaaaabbccccdc
Input
-----
The encoded form of the string, made as per the following rules.
1. If a character occurs only once, then in the encoded string, it
appears as such (for example, 'd' in the above string.)
2. If the number of consecutive occurrences of the character is
between 2 and 9, then it is represented as the character followed
by the number of occurrences (e.g. aaaab is represented as a4b).
3. If the number of consecutive occurrences of a character is greater
than 9, then group 9 occurrences as per rule 2. Iterate the set of
rules on the remaining string.
Output
------
The original string, consisting only of characters whose
encoding was given as input.
Question 3
Due on 2017-09-17, 13:00 IST
Input
-----
You are given a single line of text, with length at most 1000
characters. The text consists of English words. Adjacent words in the
line are separated by a single space.
The second line consists of a single integer 'N' denoting the width of
an output line.
Output
-----
Print the input text in the following format:
1. no line of output must be more than N characters long.
2. no word can be split across two lines. If a word does not
completely fit in a line, move the word to the next line.
Sample Input
------------
O SOFT embalmer of the still midnight Shutting with careful fingers
34
Sample Output
-------------
O SOFT embalmer of the still
midnight Shutting with careful
fingers
Explanation
-----------
Each output line is at most 34 characters long. "midnight" does not
fit on the first line, hence it was moved to the second
line. "fingers" does not fit on the second line, hence it was moved
to the third line.