From 8ec5431354bdb582455e8c32758098c5a0fdada2 Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 26 Jul 2019 23:17:36 +0200 Subject: exam final --- exam_final/subjects/5-0-last_word/subject.en.txt | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 exam_final/subjects/5-0-last_word/subject.en.txt (limited to 'exam_final/subjects/5-0-last_word/subject.en.txt') diff --git a/exam_final/subjects/5-0-last_word/subject.en.txt b/exam_final/subjects/5-0-last_word/subject.en.txt new file mode 100644 index 0000000..35d242c --- /dev/null +++ b/exam_final/subjects/5-0-last_word/subject.en.txt @@ -0,0 +1,25 @@ +Assignment name : last_word +Expected files : last_word.c +Allowed functions: write +-------------------------------------------------------------------------------- + +Write a program that takes a string and displays its last word followed by a \n. + +A word is a section of string delimited by spaces/tabs or by the start/end of +the string. + +If the number of parameters is not 1, or there are no words, display a newline. + +Example: + +$> ./last_word "FOR PONIES" | cat -e +PONIES$ +$> ./last_word "this ... is sparta, then again, maybe not" | cat -e +not$ +$> ./last_word " " | cat -e +$ +$> ./last_word "a" "b" | cat -e +$ +$> ./last_word " lorem,ipsum " | cat -e +lorem,ipsum$ +$> -- cgit