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 <vector>
#include <algorithm>
#include <numeric>

using namespace std;

#define rep(i, n) for(int i=0; i<(n); ++i)

int main(){
  int n;
  while(cin >> n, n){
      vector<int> v(n);
      rep(i, n)cin >> v[i];
      sort(v.begin(), v.end());
      int sum = accumulate(v.begin()+1, v.end()-1, 0);
      cout << sum / (n-2) << '\n';
  }
  return 0;
}

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

using namespace std;

struct CONTEST_DATA{
	int judgements;
	vector< int > points;
};

int main( void ){

	vector< CONTEST_DATA > contests;
	vector< int > answers;

	while( true ){
		CONTEST_DATA cd;
		cin >> cd.judgements;
		if( cd.judgements == 0 ){
			break;
		}
		int point;
		for( int i = 0; i < cd.judgements; i++ ){
			cin >> point;
			cd.points.push_back( point );
		}
		contests.push_back( cd );
	}

	for( int i = 0; i < contests.size(); ++i ){
		sort( contests[ i ].points.begin(), contests[ i ].points.end() );
	}
	for( int i = 0; i < contests.size(); ++i ){
		auto p = contests[i].points.begin();
		contests[ i ].points.erase( p );
	}
	for( int i = 0; i < contests.size(); ++i ){
		sort( contests[ i ].points.begin(), contests[ i ].points.end(), greater<int>() );
	}
	for( int i = 0; i < contests.size(); ++i ){
		auto p = contests[i].points.begin();
		contests[ i ].points.erase( p );
	}

	for( int i = 0; i < contests.size(); ++i ){
		int answer;
		for( int l = 0; l < contests[ i ].points.size(); ++l ){
			answer += contests[ i ].points[ l ];
		}
		answer / contests[ i ].judgements;
		answers.push_back( answer );
	}

	for( int i = 0; i < answers.size(); ++i ){
		cout << answers[ i ] << endl;
	}

	return 0;
}

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

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

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

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

C++: #include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<math.h>
#include<algorithm>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define REP(i, N) for(ll i = 0; i < N; ++i)
#define REEP(i, N) for(ll i = N - 1; i >= 0; --i)
#define FOR(i,m,n) for(ll i = m; i < n; ++i)
#define RFOR(i,m,n) for(ll i = n - 1; i >= m; --i)
#define ALL(a) (a).begin(),(a).end()
#define pb push_back
#define PB push_back
#define KIRIAGE(a, b) a += (b - a % b) % b // a ??? b ????????°????????§?¢???????
#define CEIL(c, a, b) if(a % b == 0) { c = a / b;} else { c = a / b + 1;} // a / b ??\??????????°???´??°
#define sp(n) setprecision(n)
#define INF 1000000000
#define MOD 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
int dx4[4] = {1, 0, -1, 0};
int dy4[4] = {0, 1, 0, -1};
int dx8[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(void) {
	while(true) {
		int n;
		cin>>n;
		if(!n)return 0;
		vector<int> s(n);
		ll sum = 0;
		REP(i, n) {
			cin>>s[i];
			sum += s[i];
		}
		sort(ALL(s));
		sum -= s[0];
		sum -= s[n - 1];
		cout<<sum / (n - 2)<<endl;
	}
}

C++: #include<iostream>
 
using namespace std;
 
int main(){
 
  int n;
 
  while(cin>>n){
 
 
 
    if(n==0){
      break;
    }
    int a[n];
    int max,min;
 
    max=0;
    min=1000;
 
    for(int i=0;i<n;i++){
      cin>>a[i];
 
      if(a[i]>max){
    max=a[i];
      }
 
      if(a[i]<min){
    min=a[i];
      }
    }
 
    int sum;
 
    sum=0;
 
    for(int p=0;p<n;p++){
      sum=sum+a[p];
    }
 
    sum=sum-max-min;
 
   
 
    cout << sum/(n-2) << endl; 
 
    
 
  }
 
   
 
 
 
  return 0;
}

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

using namespace std;

int n,s[1001];

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

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

int main()
{
	int number;
	int score[100];
	int sum, max, min;
	
	while(true)
	{
		cin >> number;
		if(!number) return 0;
		sum = 0, max = 0, min = 1000;
		for(int i = 0; i < number; ++i)
		{
			cin >> score[i];
			sum += score[i];
			if(score[i] > max) max = score[i];
			if(score[i] < min) min = score[i];
		}
		cout << (sum - max - min) / (number - 2) << endl;
	}
}

C++: #include "bits/stdc++.h"

#define sai(j,n) for(sei j=0;j<sei(n);++j)
#define hsai(j,n) for(sei j=sei(n)-1;j>=0;--j)
#define kan(j,m,n) for(sei j=m;j<sei(n);++j)
#define hkan(j,m,n) for(sei j=sei(n)-1;j>=sei(m);--j)
#define zen(v) (v).begin(),(v).end()
#define yu(v) v.erase(unique(zen(v)), v.end());
#define syutu(v) si(a, (v).size()) {cout << v[a];if(a != v.size()-1)cout << " ";else cout << endl;}
#define mug 10000000111;
#define yo 10000000711;
#define kyo 1e-9;

const int dx[8] = {1,1,0,-1,-1,-1,0,1};
const int dy[8] = {0,1,1,1,0,-1,-1,-1};

using namespace std;
typedef long long sei;
typedef long double syo;
typedef vector<sei> vs;
typedef vector<syo> vy;
typedef vector<vs> vvs;
typedef vector<vy> vvy;
typedef pair<sei, sei> ks;
sei max(sei a, int b) {return max(a, sei(b));}
sei max(int a, sei b) {return max(sei(a), b);}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    sei n;
    while(cin >> n,n){
        vector<sei> s(n);
        sai(j,n){
            cin >> s[j];
        }

        sort(s.begin(),s.end());
        sei m = 0;
        kan(j,1,n-1){
            m += s[j];
        }
        m /= n-2;
        cout << m << endl;
    }
    return 0;
}

C++: loop do
  l = gets.to_i
  exit if l == 0
  m = l.times.map{gets.to_i}
  puts (m.reduce(:+) - m.minmax.reduce(:+)) / (l - 2)
end

C++: //
//  main.cpp
//  no1
//
//  Created by Kae on 2015/04/23.
//  Copyright (c) 2015??´ Kae. All rights reserved.
//

#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    int n;
    while(cin >> n,n!=0){
    int max;
    int min;
    max = 0;
    min = 1005;
    int sum = 0;
    int x;
    for (int i = 0;i < n;i = i+1){
        cin >> x;
        sum = sum + x;
        if(x > max){
            max = x;}
        if(x < min){
            min = x;}
    }
    cout << (sum - max - min) / (n-2)<< endl;
    }return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int n, s[1000],i,max=0,min=1000,sum=0;

	while (1){
		scanf("%d", &n);
		if (n == 0){
			break;
		}

		sum = 0;
		max = 0;
		min = 1000;

		for (i = 0; i < n; i++){
			scanf("%d", &s[i]);
			sum += s[i];
		}

		for (i = 0; i < n; i++){
			if (max <= s[i]){
				max = s[i];
			}
		}

			for (i = 0; i < n; i++){
				if (min >= s[i]){
					min = s[i];
				}
			}

			printf("%d\n",(sum - max - min)/(n-2));
		}
	
	return 0;
}