Kth word

Write a function @kth_word(s, k)@ that given a string s and an integer
k ≥ 1 returns the $k{\it th}$ word in string s. If s has less than k
words it returns the empty string. We assume all characters of s are
letters and spaces. Warning: do not use the split string method.

Sample session

Problem information

Author: ProAl

Generation: 2026-01-25T17:48:05.012Z

© Jutge.org, 2006–2026.
https://jutge.org
