6 declare -a group_questions
12 while read -u 3 line; do
16 if [ "$line" == "" ]; then
18 for key in "${!questions[@]}"; do
19 if [ $people_in_group -eq ${questions[$key]} ]; then
20 question_string+="${key}"
23 group_questions+=($question_string)
29 people_in_group=$((people_in_group+1))
30 # go through each character of line
31 for (( a=0; a<${#line}; a++ )); do
33 if [ ${questions["$question"]+a} ]; then
34 questions["$question"]=$((${questions["$question"]}+1))
36 questions["$question"]=1
41 # last line was hit, so we need to process that too
43 for key in "${!questions[@]}"; do
44 if [ $people_in_group -eq ${questions[$key]} ]; then
45 question_string+="${key}"
48 group_questions+=($question_string)
55 for group in "${group_questions[@]}"; do
56 sum_of_groups=$((sum_of_groups+${#group}))
59 echo "Sum of groups: $sum_of_groups"