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>
#include<cmath>
#include<algorithm>
using namespace std;
int main(){
  int n;
  int po[4000]; 
  while(1)
    {
      cin >> n;
      if(n == 0)break;
      int k;
      for(k=0;k<n;k++)
	{
	  cin >> po[k];
	}
      sort(po,po+k,greater<int>());
      int ans=0;
      for(int i=1;i<k-1;i++)
	{      
	  ans+=po[i];
	}
      cout << floor(ans/(k-2)) << endl;
    }
}

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

using namespace std;
#define all(a)a.begin(),a.end()
const int INF = 1<<30;
const int mod= int(1e9)+7;

int main(){
    while(1){
        int n;cin >>n;
        if(n==0)break;
        int k=n-2;
        int sum=0;
        int mx=-1;int mint=INF;
        for (int i = 0; i < n; ++i) {
            int s;cin >>s;
            mx=max(mx,s);
            mint=min(mint,s);
            sum+=s;
        }
        sum-=(mint+mx);
        cout <<sum/k<<endl;
    }
}

C++: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

int main()
{
        while(true)
        {
                int n,A[100]={0};
                cin>>n;
                if(n==0) break;
                rep(i,n) cin>>A[i];
                sort(A,A+n);

                int sum=0;
                rep(i,n-2) sum+=A[i+1];
                cout<<sum/n<<endl;
        }
        return 0;
}

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

int a[101];

int main(){
	int n;
	while( cin >> n, n ){
		for(int i=0 ; i < n ; i++ )
			cin >> a[i];
		int mx, mn;
		mx = mn = a[0];
		for(int i=1 ; i < n ; i++ ){
			mx = max( mx , a[i] );
			mn = min( mn , a[i] );
		}
		int s = 0;
		for(int i=0 ; i < n ; i++ ){
			if( a[i] == mn ){
				a[i] = 0;
				break;
			}
		}
		for(int i=0 ; i < n ; i++ ){
			if( a[i] == mx ){
				a[i] = 0;
				break;
			}
		}
		for(int i=0 ; i < n ; i++ ){
			s += a[i];
		}
		cout << s/(n-2) << endl;
	}
}

C++: #include<iostream>
using namespace std;
 
int main(){
    int n,i;
    while(cin >> n,n){
        //int point[100]={0,};
		int p;
        int min = 1000;
        int max = 0;
		int total = 0;
        while(n--){
            //cin >> point[i];
			cin >> p;
            //if(point[i] > max) max = point[i];
			if(p > max) max = p;
            //if(point[i] < min) min = point[i];
			//total += point[i];
			if(p < min) min = p;
        }
        cout << (total-max-min)/(n-2) << "\n";
    }

}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
  int a,b[100];
  while(1)
  {
    scanf("%d",&a );
    if(a == 0)
    {
      break;
    }

    for(int i=0; i<a; i++)
    {
      scanf("%d",&b[i] );
    }

    sort(b,b+a);

    int c = 0;
    for(int i=1; i < a-1; i++)
    {
      c+=b[i];
    }
    printf("%d\n",c / (a-2) );
  }
}

C++: #include <bits/stdc++.h>
using namespace std;


int main(){
  int n = 0;
  while(1){
    cin >> n;
    if(n == 0) break;
    vector<int> score(n);
    for(int i = 0; i < n; i++){
      cin >> score[i];
    }

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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector<T> >;

int main() {
  vector<int> results;

  while (true) {
    int count;
    cin >> count;
    if (count == 0) { break; }
    vi point(count);
    for (int i = 0 ; i < count ; i++) {
      cin >> point[i];
    }
    //sort(point.begin(), point.end());
    int max_point = -1;
    int min_point = 1001;
    int ave = 0;
    for (int i = 0 ; i <= point.size()-1 ; i++) {
      ave += point[i];
      if (max_point < point[i]) {
        max_point = point[i];
      }
      if (min_point > point[i]) {
        min_point = point[i];
      }
    }
    ave -= (max_point + min_point);
    ave /= (count-2);
    results.push_back(ave);
  }

  for (int i = 0 ; i < results.size() ; i++) {
    printf("%d\n", results[i]);
  }

  return 0;
}

C++: #include <bits/stdc++.h>
#include <iterator>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(v) begin(v), end(v)
#define rreps(i, a, n) for (ll i = (a); i <= (ll)(n); ++i)
#define rrep(i, n) rreps(i, 0, n)
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define each(i, n) for (auto&& i : n)
#define fill(x, y) memset(x,y,sizeof(x))
#define debug(x) cerr << x << " " << "(L:" << __LINE__ << ")" << '\n';
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using D = double;
using P = complex<D>;
using vs = vector<string>;
template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;
const D EPS = 1e-9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template <typename T> inline void print(const T& x) {cout << x << '\n';}

signed main()
{ 
  int n;
  vi ans;
  while(cin>>n, n)
  {
    vi s(n);
    each(v,s) cin>>v;
    sort(ALL(s));
    s.pop_back();
    s.erase(s.begin());
    int sum=0;
    rep(i,s.size()) sum+=s[i];
    ans.push_back(sum/s.size());
  }
  each(v,ans) print(v);

  return 0;
}

C++: #include "algorithm"
#include "iostream"
#include "cmath"
#include "string"
#include "map"
using namespace std;


int main(){
  while(true){
  int n,min=1001,max=-1,sum=0,ten;
  cin >> n;
  if(!n)break;
  for(int i =0;i<n;i++){
    cin >> ten;
    sum+=ten;
    if(min>ten)min=ten;
    if(max<ten)max=ten;
  }
  cout << (sum-min-max)/(n-2) <<endl;
}
  return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <ctype.h>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


int main (){

  while(1){
    vector<int> point;
    int n,i,temp,sum;
    cin >> n;
    if (n==0)break;
    
    for(i=0;i<n;i++){
      cin >> temp;
      point.push_back(temp);
    }
    
    sort(point.begin(),point.end());
    
    sum = 0;
    
    for(i=1;i<n-1;i++){
      sum += point[i];
    }
    
    sum = sum / (n-2);
    
    cout << sum <<endl;
  }
  
  return 0;
}