From 56568c7dfb4eb6d93a34689b3e3e164f6ccc51f2 Mon Sep 17 00:00:00 2001 From: Augusto Date: Fri, 3 May 2019 17:29:47 +0100 Subject: [PATCH 1/2] brackets exam exercise readme --- subjects/brackets.en.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 subjects/brackets.en.md diff --git a/subjects/brackets.en.md b/subjects/brackets.en.md new file mode 100644 index 000000000..9d4f9fc76 --- /dev/null +++ b/subjects/brackets.en.md @@ -0,0 +1,33 @@ +## brackets + +### Instructions + +Write a program that takes an undefined number of strings in arguments. For each +argument, the program prints on the standard output "OK" followed by a newline +if the expression is correctly bracketed, otherwise it prints "Error" followed by +a newline. + +Symbols considered as 'brackets' are brackets '(' and ')', square brackets '[' +and ']'and braces '{' and '}'. Every other symbols are simply ignored. + +An opening bracket must always be closed by the good closing bracket in the +correct order. A string which not contains any bracket is considered as a +correctly bracketed string. + +If there is no arguments, the program must print only a newline. + +And its output : + +```console +student@ubuntu:~/student/test$ go build +student@ubuntu:~/student/test$ ./test '(johndoe)' | cat -e +OK$ +student@ubuntu:~/student/test$ ./test '([)]' | cat -e +Error$ +student@ubuntu:~/student/test$ ./test '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e +OK$ +OK$ +student@ubuntu:~/student/test$ ./test | cat -e +$ +student@ubuntu:~/student/test$ +``` From ad64d0655ef3c3fac79842a358cb0177037bdf4a Mon Sep 17 00:00:00 2001 From: Augusto Date: Wed, 8 May 2019 11:38:04 +0100 Subject: [PATCH 2/2] fixe the name of the program in the console examples --- subjects/brackets.en.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/subjects/brackets.en.md b/subjects/brackets.en.md index 9d4f9fc76..0cf79bc82 100644 --- a/subjects/brackets.en.md +++ b/subjects/brackets.en.md @@ -19,15 +19,15 @@ If there is no arguments, the program must print only a newline. And its output : ```console -student@ubuntu:~/student/test$ go build -student@ubuntu:~/student/test$ ./test '(johndoe)' | cat -e +student@ubuntu:~/student/brackets$ go build +student@ubuntu:~/student/brackets$ ./brackets '(johndoe)' | cat -e OK$ -student@ubuntu:~/student/test$ ./test '([)]' | cat -e +student@ubuntu:~/student/brackets$ ./brackets '([)]' | cat -e Error$ -student@ubuntu:~/student/test$ ./test '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e +student@ubuntu:~/student/brackets$ ./brackets '' '{[(0 + 0)(1 + 1)](3*(-1)){()}}' | cat -e OK$ OK$ -student@ubuntu:~/student/test$ ./test | cat -e +student@ubuntu:~/student/brackets$ ./brackets | cat -e $ -student@ubuntu:~/student/test$ +student@ubuntu:~/student/brackets$ ```