You have to program several functions. In each case, few lines of
code are enough. Warning: do not use the
split string method.
Write a function @um_count(s)@ that given an string
returns the number of times character u is
followed by character m in string
.
Write an integer function @word_count(s)@ that returns the number of words in string . We assume all characters of are letters and spaces.
Write a function @kth_word(s, k)@ that given a string and an integer returns the $k{\it th}$ word in string . If has less than words it returns the empty string. We assume all characters of are letters and spaces.
Write a function @suc_word(s)@ that given a string and returns the first word in string that has some uppercase letter. If all the letters in are lowercase it returns the empty string. We assume all characters of are letters and spaces.
Write a function @drawA(n)@ that given an odd integer
prints a letter A of size
formed with symbol .
Every function counts 20 points.
>>> um_count("Qui invenit amicum invenit thesauruM") 1 >>> word_count("Alea iacta est") 3 >>> kth_word("Alea iacta est", 3) est >>> suc_word("qui invenit amiCum invenit thesauruM") amiCum >>> drawA(5) * * * ***** * * * *