Week 10: Tuesday ---------------- Q1. (40) Write a program that inputs a line of characters from the user. The line may contain blanks. (Use gets.) Write a function that outputs the line (use puts) such that each word starts with a capital letter and all the other letters are small. A word starts after a blank or is at the beginning of the string. A word ends with a blank or fullstop or comma or at the end of the string. For example, if the input is This is hard the output should be This Is Hard If the input is Hello, I AM ESC101N. I wILL BE nice to you 100pc. the output is Hello, I Am Esc101n. I Will Be Nice To You 100pc. Q2. (60) Write a function select having the following signature: int select(int A[], int l, int r, int i) The function returns the ith smallest number from an array A, but only considering the elements from A[l] to A[r]. For example, if A is 5 9 3 4 8 6 1, then a call to select(A, 2, 5, 3) looks at the subarray 3 4 8 6 and returns 6. Note that for finding the median of an array A of size n, we can use select(A, 0, n-1, (n + 1) / 2). In the main() function, input an array A of size 25. Divide A into 5 clusters of size 5 each. Find the median of each cluster by a call to select. Now find the median of these medians. Separately, find the median of the whole array. Compare the two medians. The median of a set of numbers is the middle value of the given numbers when they are arranged in ascending order.