Move to 2023 folder

This commit is contained in:
Abdulkadir Furkan Şanlı
2023-12-06 18:08:26 +01:00
parent 665b592b3b
commit be2fd77729
37 changed files with 3 additions and 1 deletions

26
2023/1/1/solution.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
cd "$(dirname "$0")"
main ()
{
declare -a components
declare -i result=0
while read -r line; do
mapfile -t matches <<< "$(grep -o '[[:digit:]]' <<< "${line}")"
components+=("${matches[0]}${matches[-1]}")
done < input.txt
for value in "${components[@]}"; do
(( result += value ))
done
echo "${result}"
}
main