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 <cstdio>	
#include <cstring>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;

const int MAX_S = -1;
const int MIN_S = 1001;
int score[1001];

int main()
{
	int n, m;
	while (scanf ("%d", &n ) && n ){
		memset (score, 0, sizeof (score ) );
		int max_s = MAX_S;
		int min_s = MIN_S;
		rep (i, n ){
			int in;
			scanf (" %d", &in );
			score[in]++;
			max_s = max (max_s, in );
			min_s = min (min_s, in );
		} // end rep
		score[max_s]--;
		score[min_s]--;
		int sum = 0;
		int sum_n = 0;
		for (int i = 0; i <= 1000; i++ ){
			sum += i*score[i];
			sum_n += score[i];
		} // end for
		int res = sum/sum_n;
		printf ("%d\n", res );
	} // end loop
		
	return 0;
}

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

using namespace std;

const int MAX_N = 100;
int pts[MAX_N];
int n;

int main() {
	while (true) {
		cin >> n; if (n <= 0) break;
		for (int i = 0; i < n; ++i) 
			cin >> pts[i];
		sort(pts, pts + n);

		long pt = 0;
		for (int i = 1; i < n-1; ++i)
			pt += pts[i];

		cout << pt / (n-2) << endl;
	}

	return 0;
}

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

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

int main(){

	int n;
	while(cin >> n, n){
		int sum=0, s_max=0, s_min=10000;
		for(int i=0; i<n; i++){
			int s; cin >> s;
			sum += s;
			s_max = max(s_max, s);
			s_min = min(s_min, s);
		}
			cout << (sum - s_max - s_min)/(n-2) <<endl;
	}

	return 0;
}

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

int main()
{
    int a,b[100];
    cin>>a;
    int max=0,min=100,sum=0,result;
    for(int i=0;i<a;i++){
        cin>>b[i];
        sum+=b[i];
        if(b[i]<min){
            min=b[i];
        }
        else if(b[i]>max){
            max=b[i];
        }
    }
    result=sum-min-max;
    cout<<result/(a-2);
    return 0;
}

C++: #include <stdio.h>
#include <stdlib.h>

int main(void) {
	int sinpan;
	int input;
	int score_sum;
	int smax, smin;
	
	while(1){
		scanf("%d", &sinpan);
		if ( sinpan == 0 ) { break; }
		
		score_sum = 0;
		smax = 0;
		smin = 1000;
		
		for ( int i=0; i<sinpan; i++ ) {
			scanf("%d", &input);
			score_sum += input;
			if ( smax < input ) { smax = input; }
			if ( smin > input ) { smin = input; }
		}
		printf("%d\n", (int)( (score_sum-smax-smin)/(sinpan-2)));

	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char *argv[])
{
  for(;;) {
    int n;
    cin >> n;
    if(n == 0) break;
    vector<int> ss;
    for(int i = 0; i < n; i++) {
      int s;
      cin >> s;
      ss.push_back(s);
    }
    sort(ss.begin(), ss.end());
    int sc = 0;
    for(int i = 1; i < n-1; i++) {
      sc += ss[i];
    }
    cout << (sc / (n-2)) << 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-1,0);
    cout << sum/(n-2) <<endl;
  }
  return 0;
}

C++: //
//  main.cpp
//  ttt
//
//  Created by ??§?£? ??? on 2015/04/23.
//  Copyright (c) 2015??´ ??§?£? ???. 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=1005;
    int sum = 0;
    max = 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-min-max)/(n-2)<< endl;}
    return 0;
}

C++: #include <iostream>

int main()
{

    while(1) {
        int judgeNum = 0;
        int pointSum = 0;
        int maximumPoint = 0;
        int minimumPoint = 1000;

        std::cin >> judgeNum;
        if (judgeNum == 0) {
            break;
        }

        for(int i = 0; i < judgeNum; i++) {
            int point;
            std::cin >> point;
            if(point > maximumPoint) {
                maximumPoint = point;
            } else if (point < minimumPoint) {
                minimumPoint = point;
            }
            pointSum += point;
        }

        int answerSum = pointSum - maximumPoint - minimumPoint;

        std::cout << answerSum / (judgeNum - 2) << std::endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
  int n,mx,mn;

  while( cin>>n && n ){
    int sum=0;
    mx = -1;
    mn = 10000;
    for( int i=0,j;i<n;i++ ){
      cin >> j;
      sum +=j;
      if( j>mx ) mx=j;
      else if( j<mn ) mn =j;
    }
    sum = sum - mx -mn;
    cout << sum/(n-2) << endl;
  }
  return 0;
}

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

using namespace std;

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

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

int main() {
	while (true) {
		int n;
		cin >> n;

		if (n == 0) break;

		vector<int> score(n);

		for (int i = 0; i < n; i++) {
			cin >> score.at(i);
		}

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

		int sum = 0;

		for (int i = 1; i < n - 1; i++) {
			sum += score.at(i);
		}

		cout << sum / (n - 2) << endl;
	}
}

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

using namespace std;

int main()
{
	for (int i = 4; i > 1; i++) {
		int n;
		cin >> n;
		if (n == 0) break;
		vector<int> s(n);
		for (int b = 0; b < n; b++) {
			cin >> s[b];

		}
		
		int sum = 0;      // ????¨?????±????????????°
		for (int t = 0; t < n; t++) {
			// ??¨??¨???????´?????????????
			sum += s[t];    // ????¨??????????
		}
		
		int ma;
		int mi;
		ma = *max_element(s.begin(), s.end());
		mi = *min_element(s.begin(), s.end());
		
		double score;
		score = (sum - ma - mi) / (n - 2);
		cout << score << endl;
		

	}
}

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

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

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

int sum = 0;
for(int i=0; i<n; i++) {
if(i!=0 && i!=n-1) sum += a[i];
}

cout << sum / (n-2) << endl;
}
return 0;
}

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

int main() {
  int n;
  while (1) {
    scanf("%d", &n);
    if (n == 0) break;
    int k;
    int maxn = -1;
    int minn = 1000000;
    int sum = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d", &k);
      maxn = max(maxn, k);
      minn = min(minn, k);
      sum += k;
    }
    printf("%d\n", (sum - maxn - minn) / (n - 2));
  }
}