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

using namespace std;

bool dabu(int a, int b,int a1,int b1){
	if (a1>=b)return 0;
	if (b1<=a)return 0;
	return 1;
}

int main(){
	int n;
	vector<vector<int>>jikoku(10000,vector<int>(2));
	while (cin > > n, n){
		int ans=1;
		int ans1 = 1;
		for (int i = 0; i < n; i++){
			int si, shu;
			int  si1, si2, si3, shu1, shu2, shu3;
			scanf("%d:%d:%d %d:%d:%d", &si1, &si2, &si3, &shu1, &shu2, &shu3);
			si = 3600 * si1 + 60 * si2 + si3;
			shu = 3600 * shu1 + 60 * shu2 + shu3;
			jikoku[i][0]=si;
			jikoku[i][1]=shu;
			if (i){
				ans = 1;
				for (int j=0; j < i; j++){
					ans += dabu(jikoku[j][0], jikoku[j][1], si, shu);
				}
			}
			ans1 = max(ans, ans1);
		}
		cout << ans1 << endl;
	}
}

C++: #include<bits//stdc++.h>
using namespace std;
int main(){
    int n, h, m, s;
    while(scanf("%d", &n), n){
        int imos[86401] = {};
        for(int i = 0; i < n; i++){
            scanf("%d:%d:%d", &h, &m, &s);
            imos[3600*h+60*m+s]++;
            scanf("%d:%d:%d", &h, &m, &s);
            imos[3600*h+60*m+s]--;
        }
        int ans = 0, sum = 0;
        for(int i = 0; i < 86401; i++){
            sum += imos[i];
            ans = max(ans, sum);
        }
        printf("%d\n", ans);
    }
}

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

void read(int& s0, int& s1)
{
  char d;
  int h0, m0, h1, m1;
  cin >> h0 >> d >> m0 >> d >> s0;
  cin >> h1 >> d >> m1 >> d >> s1;
  s0 += 3600*h0 + 60*m0;
  s1 += 3600*h1 + 60*m1;
}

int main()
{
  int n;
  while (cin >> n && n != 0) {
    vector<pair<int,int> > entries(n);
    for (int i = 0; i < n; i++) {
      read(entries[i].first, entries[i].second);
    }
    sort(entries.begin(), entries.end());

    priority_queue<int, vector<int>, greater<int> > q;
    q.push(entries.front().second);
    for (int i = 1; i < n; i++) {
      if (q.top() > entries[i].first) {
        q.push(entries[i].second);
      } else {
        q.pop();
        q.push(entries[i].second);
      }
    }
    cout << q.size() << endl;
  }
  return 0;
}

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

typedef long long lint;
typedef pair<int, int> P;
#define REP(i, x, n) for(int i = x ; i < n ; ++i)
#define rep(i, n) for(int i = 0 ; i < n ; ++i)
#define repr(i, n) for(int i = n - 1 ; i >= 0 ; --i)
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(), (x).end())

const int IINF = 1e9 + 10;
const long long LLINF = (long long)1e18 + 10;
const long long MOD = (long long)1e9 + 7;
const int dx4[] = {1, 0, -1, 0}, dy4[] = {0, 1, 0, -1};
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dy8[] = {0, -1, -1, -1, 0, 1, 1, 1};
const double EPS = 1e-8;

int main(){
    int n;
    while(cin >> n, n){
        vector<int> dep(n), arr(n);
        rep(i, n){
            int h, m, s;
            scanf("%d:%d:%d", &h, &m, &s);
            dep[i] = h * 10000 + m * 100 + s;
            scanf("%d:%d:%d", &h, &m, &s);
            arr[i] = h * 10000 + m * 100 + s;
        }
        vector<bool> done(n);
        int ans = 0;
        rep(i, n){
            if(!done[i]){
                ++ans;
                int tmp = arr[i];
                REP(j, i + 1, n){
                    if(tmp <= dep[j] && !done[j]){
                        done[j] = true;
                        tmp = arr[j];
                    }
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}

C++: #include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <climits>
#include <cassert>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main()
{
	int n;
	while (cin >> n, n) {
		int seconds_in_a_day = 24 * 60 * 60 + 60 * 60 + 60;
		vi train(seconds_in_a_day, 0);
		REP(i, n) {
			int h, m, s; scanf("%d:%d:%d", &h, &m, &s);
			int departure_time = (h * 60 * 60) + (m * 60) + s;
			scanf("%d:%d:%d", &h, &m, &s);
			int arrival_time = (h * 60 * 60) + (m * 60) + s;
			FOR(t, departure_time, arrival_time) {
				++train[t];
			}
		}
		int ans = 0;
		REP(t, seconds_in_a_day) {
			ans = max(ans, train[t]);
		}
		cout << ans << endl;
	}
}

C++: #include <iostream>

using namespace std;

#define N 86410

int max(int a,int b){
	if(a>=b)return a;
	else return b;
}

int changeTime(int h,int m,int s){
	return 3600*h+60*m+s;
}

int main(){

	int n;

	int data[N];
	
	while(cin>>n){
		if(n==0)break;

		int h,m,s;
		char tmp;
		int ans=0;
		for(int i=0;i<N;i++)data[i]=0;
		for(int i=0;i<n;i++){
			cin>>h>>tmp>>m>>tmp>>s;

			data[changeTime(h,m,s)]++;

			cin>>h>>tmp>>m>>tmp>>s;
			data[changeTime(h,m,s)]--;
		}

		for(int i=1;i<N;i++){
			data[i] += data[i-1];
			ans = max(data[i],ans);
		}

		cout<<ans<<endl;
	}

	return 0;
}