Kth word

Write a function @kth_word(s, k)@ that given a string ss and an integer k1k\ge 1 returns the $k{\it th}$ word in string ss. If ss has less than kk words it returns the empty string. We assume all characters of ss 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