Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for {
		num := nextInt(sc)
		if num == 0 {
			break
		}

		score_list := []int{}
		for i := 0; i < num; i++ {
			score_list = append(score_list, nextInt(sc))
		}
		// 得点リストをソートした後、最低点と最高点を取り除く(3 ≤ n ≤ 100)
		sort.Sort(sort.IntSlice(score_list))
		score_list = score_list[1 : len(score_list)-1]
		// 得点リストの得点を合計し、スライスの個数で割って平均点を出す
		sum := 0
		for _, score := range score_list {
			sum += score
		}
		fmt.Println(sum / len(score_list))
	}
}

C++: #include <iostream>
using namespace std;
int larger(int x,int y) {
	int z = 0;
	if (x > y)z = x;
	else z = y;
	return z;
}
int smaller(int x, int y) {
	int z = 0;
	if (x < y)z = x;
	else z = y;
	return z;
}
int main(void) {
	int sinsa,a[100],sum=0,ave;
	cin >> sinsa;
	for (int i = 0; i < sinsa; i++) {
		cin >> a[i];
	}
	int n = a[0];
	for (int i = 0; i < sinsa; i++) {
		n = larger(n, a[i]);
	}
	int m = a[0];
	for (int i = 0; i < sinsa; i++) {
		m = smaller(m, a[i]);
	}
	for (int i = 0; i < sinsa; i++) {
		sum += a[i];
	}
	sum = sum - n - m;
	ave = sum / (sinsa - 2);
	cout << ave;
	return 0;

}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main()
{
	int n;
	while(cin >> n){
		if(!n)
			break;
		int p[100];
		for(int i=0;i<n;i++){
			cin >> p[i];
		}
		sort(p,p+n);
		int sum=0;
		for(int i=1;i<n-1;i++){
			sum += p[i];
		}
		cout << sum/(n-2) << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main(){
  int n;
  while(cin >> n, n!=0){
    vector<int> s;
    int input = 0;
    for(int i=0; i<n; i++){
      cin >> input;
      s.push_back(input);
    }
    sort(s.begin(), s.end());
    int sum = 0;
    for(int i=1;i<n-1;i++){
      sum += s[i];
    }
    cout << floor(sum/(n-2)) << endl;
    s.clear();
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>

using namespace std;

int main(){
  vector<vector<int>> s;
  int n[100]={};
  int ma[100]={};
  vector<int> mi(100,1000);
  int tmp,c = 0;
  for(int i=0;i<100;i++){
    cin >> n[i];
    if(!n[i])break;
    s.push_back(vector<int>());

    for(int j=0;j<n[i];j++){
      cin >> tmp;
      s[i].push_back(tmp);
      ma[i] = max(ma[i],tmp);
      mi[i] = min(mi[i],tmp);
    }
    c++;
  }
  int ans;
  for(int i=0;i<c;i++){
    ans = floor((accumulate(s[i].begin(),s[i].end(),0) - ma[i] - mi[i])/(s[i].size()-2));
    cout << ans << endl;
  }


  return 0;
}

C++: #include <iostream>
#include <algorithm>

#define FOR(i,l,n) for(int i=(l);i<(n);i++)
#define REP(i,n) FOR(i,0,n)
#define MAX_JUDGE 100
using namespace std;

int main(){
  int n,score[MAX_JUDGE];
  while(cin>>n,n){
    REP(i,n)cin>>score[i];
    sort(score,score+n);
    int sum=0;
    FOR(i,1,n-1)sum+=score[i];
    cout << sum/(n-2);
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	while(n){
		int p[100];
		for(int i = 0; i < n; i++){
			cin >> p[i];
		}
		sort(p,p+n);
		int a = 0;
		for(int i = 1; i < n-1; i++){
			a += p[i];
		}
		cout << a/(n-2) << endl;
		cin >> n;
	}
}

C++: #include<stdio.h>

int main(){

int n;
int P[102]={};
while(1){
scanf("%d",&n);if(n==0)break;
for(int i=0;i<n;i++)
scanf("%d",&P[i]);

int s=0;
for(int i=0;i<n;i++)
for(int j=n-1;j>i;j--)
if(P[j]>P[j-1]){int t=P[j];P[j]=P[j-1];P[j-1]=t;}

for(int i=0;i<n;i++)
if(i!=0&&i!=n-1)s+=P[i];

s=s/(n-2);
printf("%d\n",s);
}
return 0;
}

C++: #include <iostream>
#include <math.h>
using namespace std;

int main(){
	
	while(1){
		
		int n,s[100],m=1000,M=0,sum=0;
		cin>>n;
		if(n==0)break;
		
		for(int i=0;i<n;i++)cin>>s[i];
		
		for(int i=0;i<n;i++){
			sum+=s[i];
			if(s[i]<m)m=s[i];
			if(s[i]>M)M=s[i];
		}
		
		cout<<(sum-m-M)/(n-2)<<endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int n;
int s[100]={};
int count = 0;
int dai,syou;
int ans[1000]={};
int judge = 0;

int main()
{
    while(1){
        scanf("%d",&n);
        if(n == 0){
            break;
        }
        dai = 0;
        syou = 1000;
        for(int i=0;i<n;i++){
            scanf("%d",&s[i]);
            if(dai <= s[i]){
                dai = s[i];
            }
            if(syou >= s[i]){
                syou = s[i];
            }
        }
        int dai_count = 0;
        int syou_count = 0;
        for(int i=0;i<n;i++){
            if(s[i]==dai && dai_count ==0){
                dai_count=1;
                
            }else if(s[i] == syou && syou_count ==0){
                syou_count = 1;
            }else{
                ans[judge] += s[i];
            }
        }
        ans[judge] = ans[judge] / (n-2);
        
        judge++;

    }
    for(int i=0;i<judge;i++){
        cout << ans[i] << endl;
    }

    
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <numeric>

#define FOR(i,l,n) for(int i=(l);i<(n);i++)
#define REP(i,n) FOR(i,0,n)
#define MAX_JUDGE 100
using namespace std;

int main(){
  int n,score[MAX_JUDGE];
  while(cin>>n,n){
    REP(i,n)cin>>score[i];
    sort(score,score+n);
    int sum = accumulate(score+1,score+n-2,0);
    cout << sum/(n-2) <<endl;
  }
  return 0;
}

C++: #include<stdio.h>
int main(void) {
	int n, s[100] = {0}, max, min,sum,count;
	while(1){
		sum = 0;
		count = 0;
		scanf("%d", &n);
		if (n== 0) break;
		for (int i = n; i > 0; i--) {
			scanf("%d", &s[i]);
			if (i == n) {
				max = s[i];
				min = s[i];
			}
			if (max < s[i]) max = s[i];
			if (min > s[i]) min = s[i];
			count++;
			sum += s[i];
		}
		sum = sum - (max + min);
		printf("%d\n", sum / (count - 2));
	}
	return 0;
}