From 9ab6d93d314be7811b7328aaeb0953035e75b355 Mon Sep 17 00:00:00 2001 From: lee Date: Fri, 3 May 2019 12:39:55 +0100 Subject: [PATCH] revwstr exr for the exams --- subjects/revWstr.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 subjects/revWstr.md diff --git a/subjects/revWstr.md b/subjects/revWstr.md new file mode 100644 index 00000000..61ef1610 --- /dev/null +++ b/subjects/revWstr.md @@ -0,0 +1,26 @@ +## revwstr + +### Instructions + +Write a program that takes a string as a parameter, and prints its words in reverse. + +- A "word" is a part of the string bounded by spaces and/or tabs, or the begin/end of the string. + +- If the number of parameters is different from 1, the program will display `\n`. + +- In the parameters that are going to be tested, there won't be any additional" spaces (meaning that there won't be additionnal spaces at the beginning or at the end of the string, and words will always be separated by exactly one space). + +Example of output : + +```console +student@ubuntu:~/piscine/test$ go build +student@ubuntu:~/piscine/test$ ./test "the time of contempt precedes that of indifference" +indifference of that precedes contempt of time the +student@ubuntu:~/piscine/test$ ./test "abcdefghijklm" +abcdefghijklm +student@ubuntu:~/piscine/test$ ./test "he stared at the mountain" +mountain the at stared he +student@ubuntu:~/piscine/test$ ./test + +student@ubuntu:~/piscine/test$ +``` \ No newline at end of file