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 <bits/stdc++.h>
using namespace std;

int main() {
  while (1) {
    int N;
    cin >> N;
    if (N == 0) break;

    vector<int> table(86450, 0);
    for (int i = 0; i < N; i++) {
      string D;
      string A;
      cin >> D >> A;

      int DH = stoi(D.substr(0, 2)) * 3600;
      int DM = stoi(D.substr(3, 2)) * 60;
      int DS = stoi(D.substr(6, 2));
      int d = DH + DM + DS;

      int AH = stoi(A.substr(0, 2)) * 3600;
      int AM = stoi(A.substr(3, 2)) * 60;
      int AS = stoi(A.substr(6, 2));
      int a = AH + AM + AS;
      table.at(d)++;
      table.at(a)--;
    }

    for (int i = 0; i <= 86400; i++) {
      if (0 < i) table[i] += table[i - 1];
    }

    int M = 0;
    for (int i = 0; i <= 86400; i++) {
      if (M < table[i]) M = table[i];
    }

    cout << M << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef  pair<int,int>P;
int main(){
  int n;
  vector<P>ve;
  while(cin >> n,n){
    int T[10000] = {0},S[10000] = {0};
    for(int i = 0 ; i < n ; i++ ){
      int a,b,c;
      char ch;
      cin >> a >> ch >> b >> ch >> c;
      S[i] = a*3600 + b*60 + c;
      cin >> a >> ch >> b >> ch >> c;
      T[i] = a*3600 + b*60 + c;
      ve.push_back(P(T[i],S[i]));
    }

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

    int ans = 1,p = 0;
    for(int i = 0 ; i < n-1 ; i++ ){
      cout << ve[i+1].second << ' ' << ve[i+1].first << endl;
      if(ve[i].first > ve[i+1].second ){ans++;}
      if(ve[p].first <= ve[i].second && ans > 1 ){ans--;p++;}
    }
    cout << ans << endl;
  }
}

C++: /*
    Problem 82
    https://onlinejudge.u-aizu.ac.jp/problems/2013
*/
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 24*3600+2;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
vector<int> T(MAX);
/* function */
int stringToSecond(string S) {
    int t = stoi(S.substr(0, 2)) * 3600 + stoi(S.substr(3, 2)) * 60 + stoi(S.substr(6, 2));
    return t;
}
void solve(int N) {
    for (int i = 0; i <= MAX; i++) T[i] = 0;
    for (int i = 0; i < N; i++) {
        string st; cin >> st;
        string gl; cin >> gl;
        T[stringToSecond(st)]++;
        T[stringToSecond(gl)]--;
    }
    int ans = 0;
    for (int i = 0; i <= MAX; i++) {
        T[i+1] += T[i];
        ans = max(ans, T[i]);
    }
    cout << ans << '\n';
}
/* main */
int main(){
    while (1) {
        int N;
        cin >> N;
        if (N == 0) return 0;
        solve(N);
    }
}

C++: #include <stdio.h>
#include <algorithm>
using namespace std;
int r[86401], n, h1, m1, s1, h2, m2, s2;
int main() {
	while (~scanf("%d", &n)) {
		if (n == 0) break;
		for (int i = 0; i <= 90000; i++) r[i] = 0;
		for (int i = 0; i < n; i++) {
			scanf("%02d:%02d:%02d %02d:%02d:%02d", &h1, &m1, &s1, &h2, &m2, &s2);
			r[h1 * 3600 + m1 * 60 + s1]++;
			r[h2 * 3600 + m2 * 60 + s2]--;
		}
		int ret = 0, sum = 0;
		for (int i = 0; i <= 90000; i++) {
			sum += r[i];
			ret = max(ret, sum);
		}
		printf("%d\n", ret);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define each(a, b) for(auto (a): (b))
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define pb push_back
#define show(x) cout <<#x<<" = "<<(x)<<endl
#define spair(p) cout <<#p<<": "<<p.fi<<" "<<p.se<<endl
#define svec(v) cout<<#v<<":";rep(i,v.size())cout<<" "<<v[i];cout<<endl
#define sset(s) cout<<#s<<":";each(i,s)cout <<" "<<i;cout<<endl

using namespace std;

typedef pair<int,int>P;

const int MAX_N = 100005;

int n;
int a[24*60*60+1];

int tt(string s1)
{
    string ss;
    ss = s1.substr(0,2);
    int h = stoi(ss);
    ss = s1.substr(3,2);
    int m = stoi(ss);
    ss = s1.substr(6,2);
    int s = stoi(ss);
    return h*60*60 + m*60 + s;
}

int main()
{
    while(1){
        cin >> n;
        if(n == 0){
            break;
        }
        rep(i,24*60*60+1){
            a[i] = 0;
        }
        rep(i,n){
            string s1,s2;
            cin >> s1 >> s2;
            a[tt(s1)]++,a[tt(s2)]--;
        }
        int res = 0;
        int nw = 0;
        rep(i,24*60*60+1){
            nw += a[i];
            res = max(res,nw);
        }
        cout << res << "\n";
    }
}