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;

typedef long long LL;
typedef vector<int>    VI;
typedef vector<bool>   VB;
typedef vector<string> VS;

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int n;
VI ss, gs;

const int INF = INT_MAX / 2;

bool check(int s, int g, VI& gts) {
	rep (i, gts.size()) {
		if (s >= gts[i]) {
			gts[i] = INF;
			return true;
		}
	}
	return false;
}

int main(void) {
	while (1) {
		ss.clear();
		gs.clear();
		cin >> n;
		if (n == 0) break;
		VI gts;
		rep (i, n) {
			int h, m, s;
			scanf("%d:%d:%d", &h, &m, &s);
			int stime = h * 60 * 60;
			stime += m * 60;
			stime += s;
			scanf("%d:%d:%d", &h, &m, &s);
			int gtime = h * 60 * 60;
			gtime += m * 60;
			gtime += s;
			ss.PB(stime);
			gs.PB(gtime);
			gts.PB(gtime);
		}
		sort(ALL(gts));
		reverse(ALL(gts));
		int ans = 0;
		rep (i, n) {
			if (!check(ss[i], gs[i], gts)) {
				ans++;
			}
		}
		cout << ans << endl;
	}
    return 0;
}

C++: 
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
typedef pair<int, int> P;
int N;
P G[10000];
int solve(){
  int res = 0;
  int c = 0;
  for (int i = 0; i < 2*N; i++){
    if (G[i].second){
      c++;
      res = max(c, res);
    }
    else{
      c--;
    }
  }
  return res;
}
int main(){
  while (1){
    cin >> N;
    if (N == 0) break;
    for (int i = 0; i < N; i++){
      for (int j = 0; j < 2; j++){
	char str[10];
	cin >> str;
	int a = (str[0]-'0')*10 + str[1]-'0';
	int b = (str[3]-'0')*10 + str[4]-'0';
	int c = (str[6]-'0')*10 + str[7]-'0';
	G[i*2+j] = P(a*60*60 + b*60 + c, 1-j);
      }
    }
    sort(G, G+2*N);
    cout << solve() << endl;
  }
}

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

int main() {
  int n;
  int h1, m1, s1;
  int h2, m2, s2;

  while(cin >> n, n!=0){
    int res = 0;
    signed int time[24*3600+60*60+60] = {0};
    for(int i = 0; i < n; i++) {
      scanf("%d:%d:%d", &h1, &m1, &s1);
      scanf("%d:%d:%d", &h2, &m2, &s2);
      time[h1*3600+m1*60+s1]++;
      time[h2*3600+m2*60+s2]--;
    }

    for(int i = 0; i < 24*3600+59*60+59; i++) {
      time[i+1]+=time[i];
      if(res < time[i+1])
        res = time[i+1];
    }
    cout << res << endl;
  }
  return 0;
}

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

int toNum(string s){
    int time = 0;
    time += (s[0] - '0') * 10 * 3600;
    time += (s[1] - '0') * 3600;
    time += (s[3] - '0') * 10 * 60;
    time += (s[4] - '0') * 60;
    time += (s[6] - '0') * 10;
    time += (s[7] - '0');
    return time;
}

int main(){
    int n;
    while(cin >> n && n){
        vector<int> time(86401);
        for(int i = 0; i < n; i++){
            string s, t;
            cin >> s >> t;
            int start = toNum(s), goal = toNum(t);
            time[start]++;
            time[goal]--;
        }
        int ans = 0;
        for(int i = 1; i < 86401; i++){
            time[i] += time[i-1];
            if(ans < time[i]) ans = time[i];
        }
        cout << ans << endl;
    }
}

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

int n;
struct jikoku{
    int hh,hm,hs,ah,am,as;
};
bool operator<(const jikoku j1,const jikoku j2){
    if(j1.ah<j2.ah)return 1;
    if(j1.ah==j2.ah&&j1.am<j2.am)return 1;
    if(j1.ah==j2.ah&&j1.am==j2.am&&j1.as<j2.as)return 1;
    return 0;
}
bool comh(const jikoku j1,const jikoku j2){
    if(j1.hh<j2.hh)return 1;
    if(j1.hh==j2.hh&&j1.hm<j2.hm)return 1;
    if(j1.hh==j2.hh&&j1.hm==j2.hm&&j1.hs<j2.hs)return 1;
    return 0;
}
bool ok(const jikoku j1,const jikoku j2){
    if(j1.ah<j2.hh)return 1;
    if(j1.ah==j2.hh&&j1.am<j2.hm)return 1;
    if(j1.ah==j2.hh&&j1.am==j2.hm&&j1.as<=j2.hs)return 1;
    return 0;
}
vector<jikoku>vec;

int main(){
   // freopen("/Users/shitian/Downloads/2013-input.txt","r",stdin);
    while(cin>>n,n){
        vec.clear();
        for(int i=0;i<n;i++){
            jikoku j;
            char c;
            cin>>j.hh>>c>>j.hm>>c>>j.hs>>j.ah>>c>>j.am>>c>>j.as;
            vec.push_back(j);
        }
        vector<jikoku>se;
        for(int i=0;i<n;i++){
            se.push_back(vec[i]);
        }
        sort(se.begin(),se.end());
        sort(vec.begin(),vec.end(),comh);
        for(int i=0;i<n;i++){
            if(ok(*se.begin() , vec[i])){
                se.erase(se.begin());
            }
        }
        cout<<se.size()<<endl;
    }
}

C++: #include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
#define MOD 100000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
int rec(int h,int m,int s){
      return h*3600+m*60+s;
}
int cnt[60*60*24+1];
int main(){
      int n;
      while(cin>>n&&n){
            int h1,m1,s1,h2,m2,s2;
            REP(i,n){
                  scanf("%d:%d:%d %d:%d:%d",&h1,&m1,&s1,&h2,&m2,&s2);
                  cnt[rec(h1,m1,s1)]++;
                  cnt[rec(h2,m2,s2)+1]--;
            }
            int ans=0;
            REP(i,60*60*24+1){
                  if(i==0)continue;
                  ans=max(cnt[i],ans);
            }
            cout<<ans<<endl;
      }
}