0% found this document useful (0 votes)
25 views4 pages

TBU Questions

Uploaded by

Sanjiv TS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views4 pages

TBU Questions

Uploaded by

Sanjiv TS
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

1.

alphabets rearrange question


2. string occurance question
3. alphabets increase by 13 places
4. Its an encoding question where we should find the occurances of a characters in a string and
print the output in the first occurance order for eg: if the string is "ACCOMODATION" then
the output will be 22311111
5. Draw a solution to a coding problem where one "word" is coded into another word which is
displayed as the output. Analyse the following examples and build a program that accepts a
word as input and provides the decoded text as output.
Some examples are here in the table.

S.No
INPUT
OUTPUT

1
FRUIT
11111

2
PAPER
2111

3
BOOKS
1211

4
HELLOWORLD
1132111

5
KNOWLEDGE
11111211

6
AAA
3
Read the input from STDIN and print the output to STDOUT. Do not write arbitrary strings anywhere
in the program, as these contribute to the standard output, and test cases will fail.

Constraints:

i) Length of the input 'word' >0

ii) Only English alphabets are allowed in the 'word'.


iii) Word can contain only uppercase alphabets.

iv) No special characters are allowed.

v) No character should repeat more than nine times in the input 'word'.

Input Format:

The only line of input contains a string word' that is to be coded.

Output Format:

The only line of output consists of the string which denotes the output processed through the input
'word'.

Sample Input1:

UNPUZZLING

Sample Output1:

2212111

Sample Input2:

ACCOMMODATINGLY

Sample Output2:

22221111111

6.

Maximum Number of word count in a given


string list

Input: “Run and run, they said, but to run and run
is tiring”

Output: Run (most repeated)

7.

Given the dimensions m x n and elements of a square matrix, find the sum of the left diagonal
elements which are not repeated elsewhere in the matrix. If the dimensions given are not that of a
square matrix, convert it into a square matrix by adding the element "1" for all the missing values
after the given elements. The left diagonal runs from the top left corner to the bottom right corner of
the matrix.
Note: If all the left diagonal elements are repeated elsewhere in the matrix, then print "0".

Read the input from STDIN and write the output to STDOUT Do not write arbitrary strings while
reading the input and while printing, as these contribute to the standard output.

Constraints:

1) 1<m<=10

II) 1<=n<= 10

Input Format:

The first line of input contains two integers separated by a single white space, m and n, which are
dimensions of the matrix where m is the number of rows and n is number of columns.

The second line has m'n integers separated by single white space. The elements of the first row are
given first, then the second row and so on.

Output Format:

The output contains an integer, which is the required sum.

Sample Input1;

23

11 12 13 14 15 11

Sample Output

15

8.

Given a sentence of words we need to return the highest occurring first character
Example:
input
words = “grass is greener on the other side”
Output
“g”

Explanation:
Char “g” is repeated 2 times and o is repeated 2 times

how:
if you see the first chars of each word that is
“g I g o t o s” g-2, i-1, o-2, t-2, s-1
In the case where there are two maximum occurrence of a char then we should return first
highest occurrence

You might also like