#!/bin/bash read -p "26-long sequence?" input declare -A results steps=(3 5 7 9 11) for step in "${steps[@]}"; do decimated="" length=${#input} index=0 while [ ${#decimated} -lt 26 ]; do char="${input:index:1}" if [[ ! "$decimated" =~ "$char" ]]; then decimated+="$char" fi index=$((index + step)) if [ $index -ge $length ]; then index=$((index - length)) fi done results["$step"]="$decimated" done echo "Original string: $input" for step in "${steps[@]}"; do formatted_decimated=$(echo "${results[$step]}") echo -e ":: $formatted_decimated | ($step)" done