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
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <queue>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned long long ULL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int gcd(int a, int b){
   int tmp;
   while(a%b==0){
      tmp=a%b;
      a=b;
      b=tmp;
   }
}

int lcm(int a,int b){
   return a*b/gcd(a,b);
}

bool prime_number(int n){
   if(n < 2){
      return false;
   }
   else if(n == 2){
      return true;
   }
   if(n % 2 == 0){
      return false;
   }
   for(int i=3;i<=n/i;i+=2){
      if(n % i == 0) return false;
      return true;
   }
}

int main(){
   int n,tmp,ans;
   VI s;
   while(1){
      cin >> n;
      if(n==0) break;
      REP(i,n){
         cin >> tmp;
         s.PB(tmp);
      }
      ans=(accumulate(ALL(s),0)-*(min_element(ALL(s)))-*(max_element(ALL(s))))/(n-2);
      cout << ans << endl;
      s.clear();
   }
}

C++: #include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;


int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0){
      break;
    }
    vector<int> s(n);
    for(int i=0;i<n;i++){
      cin>>s[i];
    }
    sort(s.begin(),s.end());
    s.erase(s.end()-1);
    s.erase(s.begin());
    int sum=0,avg;
    for(int i=0;i<s.size();i++){
      sum+=s[i];
    }
    avg=sum/s.size();
    cout<<avg<<endl;
  }
  return 0;
}

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

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

C++: #include <iostream>
#include <cstdio>
#include <stack>
#include <queue>

#define N 128

int main(void) {
	while(1) {
		int n;
		int s[N];
		int sum = 0, max, min, point;
		scanf("%d", &n);
		if(n == 0) break;
		for(int i = 0; i < n; i++) {
			scanf("%d", &s[i]);
		}
		max = min = s[0];
		for(int i = 0; i < n; i++) {
			sum += s[i];
			if(s[i] > max) max = s[i];
			if(s[i] < min) min = s[i];
		}
		point = (sum - max - min) / (n - 2);
		printf("%d\n", point);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
while(1){ 
cin>>n;
if(!n) break;
vector<int> v(n);

int sum=0;
 for(int i=0;i<n;++i){
cin>>v[i];
}
sort(begin(v),end(v));
for(int i=1;i<n-1;++i){
sum+=v[i];}
cout<<sum/(n-2)<<endl;
}}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
using namespace std;
int main() {
	while (true) {
		int n = 0;
		scanf("%d", &n);
		if (n == 0) break;
		vector<int> a;
		for (int i = 0;i < n;++i) {
			int b = 0;scanf("%d",&b );
			a.push_back(b);
		}
		sort(a.begin(), a.end());
		int num = 0;
		for (int i = 0;i < n;++i) {
			num += a[i];
		}
		num -= (a[0] + a[n - 1]);
		printf("%d\n", num/(n-2));
	}
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int n, max, min, s, t;
	
	while(1){
		cin >> n;
		if(n == 0){
			break;
		}
		min = 1001;
		max = s = 0;
		for(int i = 0; i < n; i++){
			cin >> t;
			if(t < min){
				min = t;
			}
			if(max < t){
				max = t;
			}
			s += t;
		}
		
		cout << (s-min-max)/(n-2) << endl;
	}
	
	return 0;
}

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

using namespace std;

int main(){
	vector<int> array;
	int i,x,max,min,sum;
	max = 0;
	min = 1000;

	while(cin>>n){
	clear(array);
	sum=0;

	for(i=0;i<sizeof(array);i++){
		cin >> x;
		array.push_back(x);
	}
	for(i=0;i<n;i++){
		if(max<array[i]){
			max= array[i];
		}
	}
	for(i=0;i<n;i++){
		if(min>array[i]){
			min= array[i];
		}
	}
	for(i=0;i<sizeof(array);i++){
		sum += array[i];
	}
	sum = sum-max-min;
	cout << sum/sizeof(array) << endl; 
	}

}

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

using namespace std;

int main(){
  int i, n, s, sum, avg;
  vector<int> data;

  while(1){
    cin >> n;
    if(n == 0) break;

    for(i=0; i<n; ++i){
      cin >> s;
      data.push_back(s);
    }

    sort(data.begin(), data.end());

    for(i=1, sum=0; i<n-1; ++i)
      sum += data[i];

    avg = sum / (data.size()-2);

    cout << avg << endl;
    data.clear();
  }

  return 0;
}