Description
3A Problem Description:
While diff is a useful text-processing utility that finds differences between the
contents of two files, this naive diff will start out as a simplistic check, counting
how many of the leading characters of two lines of text are the same.
Input Specification:
The first line contains N, 1 ≤ N ≤ 25, the number of text pairs to be compared.
The next (N*2) lines will contain N sets of input, two lines each. Each line will be
a non-empty string less than 255 characters long.
Output Specification:
The output will comprise of N lines, each printing an integer 0 ≤ i ≤ 255 – the
number of leading characters that are same between the two lines, up to the first
difference.
Note that the two lines could be of different lengths. The counter stops before the
first character that doesn’t match, so two strings that start differently would have
a result of 0.
Sample Test Case:
Test Case Input Test Case Output
5
tony
tony
dan
tony
one two three
one two four
a
b
abcd
abcde
4
0
8
0
4
3B Problem Description:
Basketball players are ranked according to a statistic called points per minute
(ppm). This is calculated by dividing the points scored by a player by the number
of minutes that the player has played on the court. The resulting value is scaled
to 1000 and rounded to an integer. The program must output name of the player
and the value of the statistic for a given rank. You can assume that there will be
no ties.
Input Specification:
The first line contains N, the number of players on the team, 1 < N ≤ 50 and the
required rank. For each player on the team, there will be 5 lines of data their
name (in upper case), number of foul shots made (one point each), number of
field goals made (two points each), number of three-point baskets made (three
points each), number of minutes played, an integer > 0.
Output Specification:
The output will comprise of a single line containing name of the player followed
by the score with exactly one space between them and terminated by new line
character. No leading or trailing spaces for the name or the score.
Sample Test Case:
Test Case Input Test Case Output
6 3
KATIE
24
12
4
85
JULIA
25
13
9
97
HILLARY
34
19
2
125
CALLIE
12
6
8
120
AMANDA
14
16
3
90
JOHANNA
12
8
6
60
KATIE 706