Go: package main

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

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		n := io.NextInt()
		if n == 0 {
			break
		}
		accum := make([]int, 86401)
		for i := 0; i < n; i++ {
			s, e := io.Next(), io.Next()
			hs, _ := strconv.Atoi(s[:2])
			ms, _ := strconv.Atoi(s[3:5])
			ss, _ := strconv.Atoi(s[6:8])
			accum[hs*60*60+ms*60+ss]++
			he, _ := strconv.Atoi(e[:2])
			me, _ := strconv.Atoi(e[3:5])
			se, _ := strconv.Atoi(e[6:8])
			accum[he*60*60+me*60+se]--
		}
		ans := 0
		for i := 1; i < 86401; i++ {
			accum[i] += accum[i-1]
			ans = intMax(accum[i], ans)
		}
		io.Println(ans)
	}
}

func intMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>

using namespace std;


struct Info{
	bool operator<(const struct Info &arg) const{
		return start < arg.start;
	};
	int start,back;
};

struct Train{
	int start,back;
};

void func(int N){

	int hour,minute,second;
	Info info[N];
	char left[10],right[10];
	bool FLG;


	for(int i = 0; i < N; i++){
		scanf("%s %s",left,right);

		hour = 10*(left[0]-'0')+(left[1]-'0');
		minute = 10*(left[3]-'0')+(left[4]-'0');
		second = 10*(left[6]-'0')+(left[7]-'0');

		info[i].start = 3600*hour+60*minute+second;

		hour = 10*(right[0]-'0')+(right[1]-'0');
		minute = 10*(right[3]-'0')+(right[4]-'0');
		second = 10*(right[6]-'0')+(right[7]-'0');

		info[i].back = 3600*hour+60*minute+second;
	}

	sort(info,info+N);

	Train train[N];
	int index = 0;

	train[0].start = info[0].start;
	train[0].back = info[0].back;
	index++;

	for(int i = 1; i < N; i++){

		FLG = false;

		for(int k = 0; k < index; k++){
			if(train[k].back <= info[i].start){
				train[k].start = info[i].start;
				train[k].back = info[i].back;
				FLG = true;
				break;
			}
		}

		if(!FLG){
			train[index].start = info[i].start;
			train[index].back = info[i].back;
			index++;
		}
	}
	printf("%d\n",index);

}

int main(){

	int N;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func(N);
	}

    return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n;
ll sum[100100];

int main() {
	while (cin >> n&&n) {
		fill(sum, sum + 100100, 0);
		REP(i, n) {
			char c;
			int h, m, s;
			cin >> h >> c >> m >> c >> s;
			sum[h * 60 * 60 + m * 60 + s]++;
			cin >> h >> c >> m >> c >> s;
			sum[h * 60 * 60 + m * 60 + s]--;
		}
		ll ans = 1;
		REP(i, 100100) {
			sum[i + 1] += sum[i];
			ans = max(ans, max(sum[i + 1], sum[i]));
		}
		cout << ans << endl;
	}
}

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

typedef pair<int,int> P;

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back

int n;

void solve() {
  vector<P> train;
  rep(i,n) {
    int hh, mm, ss, b, e;
    char c;
    cin>>hh>>c>>mm>>c>>ss;
    b = hh * 3600 + mm * 60 + ss;
    cin>>hh>>c>>mm>>c>>ss;
    e = hh * 3600 + mm * 60 + ss;
    train.pb(P(b, e));
  }
  sort(train.begin(), train.end());
  
  const int zzz = train.size();
  vector<P>::iterator it = train.begin();
  vector<int> times;
  rep(z,zzz) {
    bool flag = false;
    rep(i,times.size()) {
      if (times[i] <= (int)(it->first)) {
        times[i] = it->second;
        flag = true; break;
      }
    }
    if (!flag) times.pb(it->second);
    train.erase(it);
  }
  cout<<times.size()<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>n, n) {
    solve();
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
using namespace	std;
int main(){

  string a,b[10000];
  int i,n,result=0,bnum,use;

  while(cin>>n,n){
    cin>>a;
    result=1;
    for(i=0;i<n-1;i++){
      use=0;
      cin>>b[i]>>a;
      sort(b,b+i+1);
      for(int j=i;j!=-1;j--){
        if(b[j]<=a){
          b[j]="334334334334";
          use=1;
          break;
        }
      }
      //for(int j=0;j<i+1;j++) cout<<b[j]<<" ";                                                                                                                                                
      //cout<<endl;                                                                                                                                                                            
      if(use==0) result++;
    }
    cin>>a;
    cout<<result<<endl;
  }
    return 0;

}