diff options
| -rw-r--r-- | challenge-095/abigail/awk/ch-1.awk | 28 | ||||
| -rw-r--r-- | challenge-095/abigail/t/ctest.ini | 6 |
2 files changed, 34 insertions, 0 deletions
diff --git a/challenge-095/abigail/awk/ch-1.awk b/challenge-095/abigail/awk/ch-1.awk new file mode 100644 index 0000000000..e198996b20 --- /dev/null +++ b/challenge-095/abigail/awk/ch-1.awk @@ -0,0 +1,28 @@ +{ + # + # Initialize + # + is_palindrome = 0 +} + +/^[0-9]+(\.[0-9]+)?$/ { + # + # If it looks like an unsigned number, check whether + # it's a palindrome. + # + is_palindrome = 1 + for (i = 1; i <= length / 2; i ++) { + s1 = substr($0, i, 1) + s2 = substr($0, length - i + 1, 1) + if (s1 != s2) { + is_palindrome = 0 + } + } +} + +{ + # + # Print result + # + print is_palindrome +} diff --git a/challenge-095/abigail/t/ctest.ini b/challenge-095/abigail/t/ctest.ini index 3712da6655..250efe85a4 100644 --- a/challenge-095/abigail/t/ctest.ini +++ b/challenge-095/abigail/t/ctest.ini @@ -15,3 +15,9 @@ skip = No Unicode support [1-5/c]
skip = No Unicode support
+
+[1-4/awk]
+skip = No Unicode support
+
+[1-5/awk]
+skip = No Unicode support
|
