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)
}

Python: while 1:
    n=int(input())
    if n==0:break
    DP=[0 for _ in range(24*10**4+1)]
    for i in range(n):
        a,b=map(lambda x:int("".join(x.split(":"))),input().split())
        DP[a] +=1
        DP[b] -=1
    for i in range(1,24*10**4+1):
        DP[i]=DP[i]+DP[i-1]
    print(max(DP))

Python: while True:
    N = int(input())
    if N == 0:
        exit()
    L = [list(map(int,input().replace(':','').split())) for _ in range(N)]
    T = [0]*240002
    for l in L:
        T[l[0]] += 1
        T[l[1]] -= 1
    for i in range(240002):
        if i > 0:
            T[i] += T[i-1]
    print(max(T))

Python: m=24*60*60
while True:
	n=int(raw_input())
	if n==0:break
	dp=[0]*(m+1)
	for _ in range(n):
		a,d=raw_input().split()
		a,b,c=map(int,a.split(':'));
		d,e,f=map(int,d.split(':'));
		dp[a*3600+b*60+c]+=1
		dp[d*3600+e*60+f]-=1
	for i in range(m):
		dp[i+1]+=dp[i]
	print(max(dp))

Python: from itertools import accumulate

def time_to_seconds(time):
    h, m, s = time.split(':')
    return int(h) * 3600 + int(m) * 60 + int(s)

ans = []
while(1):
    N = int(input())
    if N==0:
        break
    A = []
    for n in range(N):
        begin, end = input().split()
        begin = time_to_seconds(begin)
        end = time_to_seconds(end)
        A.append((begin,1))
        A.append((end,-1))
    A.sort()
    mx = 0
    cumsum = 0
    for _, x in A:
        cumsum += x
        mx = max(mx, cumsum)
    ans.append(mx)

for a in ans:
    print(a)

Python: while True:
    n = int(input())
    if n == 0:
        break
    t = []
    for i in range(n):
        t.append(list(map(str, input().split())))
    
    l = [0]*(10**6)
    for i in range(n):
        date = []
        for j in range(2):
            date.append(list(t[i][j]))

        date1 = 3600*(int(date[0][0])*10+int(date[0][1])) + 60*(int(date[0][3])*10+int(date[0][4])) + (int(date[0][6])*10+int(date[0][7]))
        date2 = 3600*(int(date[1][0])*10+int(date[1][1])) + 60*(int(date[1][3])*10+int(date[1][4])) + (int(date[1][6])*10+int(date[1][7]))

        l[date1] += 1
        l[date2] -= 1
    
    for i in range(len(l)-1):
        l[i+1] += l[i]

    print(max(l))

Python: from itertools import accumulate
from sys import stdin
input = stdin.readline

def calctime(string):
    h,m,s = map(int, string.split(':'))
    time = h*60*60 + m*60 + s
    return time

maxtime = 24*60*60
while True:
    n = int(input())
    if n == 0:
        break
    trainlist = [0]*(maxtime)
    for _ in range(n):
        start, end = input().split()
        start = calctime(start)
        end = calctime(end)
        trainlist[start] += 1
        trainlist[end] -= 1
    trainlist = accumulate(trainlist)
    print(max(trainlist))

Python: m=24*60*60
while True:
	n=int(input())
	if n==0:break
	dp=[0]*(m+1)
	for _ in range(n):
		a,d=input().split()
#		a,b,c=map(int,a.split(':'));
#		d,e,f=map(int,d.split(':'));
#		dp[a*3600+b*60+c]+=1
#		dp[d*3600+e*60+f]-=1
#	for i in range(m):
#		dp[i+1]+=dp[i]
#	print(max(dp))

Python: from itertools import accumulate

while True:
  n = int(input())
  if n == 0:
    break

  def to_sec(time):
    h, m, s = map(int, time.split(":"))
    return 3600 * h + 60 * m + s
  section = [0] * (60 * 60 * 24)
  for _ in range(n):
    t1, t2 = map(to_sec, input().split())
    section[t1] += 1
    section[t2] -= 1

  section_acc = accumulate(section)
  print(max(section_acc))

Python: from datetime import datetime
ts = '%H:%M:%S'
while(True):
    n = int(input())
    if n == 0:
        break
    ipt = [None]*n
    for i in range(len(ipt)):
        ipt[i] = list(map(lambda x: datetime.strptime(x,ts),input().split()))
    ipt = sorted(ipt)
    l = [datetime.strptime('00:00:00',ts)]
    for i in range(len(ipt)):
        for j in range(len(l)):
            if l[j] <= ipt[i][0]:
                l[j] = ipt[i][1]
                break
        else:
            l.append(ipt[i][1])
    print(len(l))

Python: m=24*60*60
while True:
	n=int(input())
	if n==0:break
	dp=[0]*(m+1)
	for _ in range(n):
		a,d=input().split()
		a,b,c=map(int,a.split(':'));
		d,e,f=map(int,d.split(':'));
		dp[a*3600+b*60+c]+=1
		dp[d*3600+e*60+f]-=1
	for i in range(m):
		dp[i+1]+=dp[i]
	print(max(dp))

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

int main(void){
  int n;
  while(cin>>n,n){
    vector<pair<int,int> > timetable(n);
    for(int i=0;i<n;++i){
      int sh,sm,ss,eh,em,es;
      scanf("%d:%d:%d",&sh,&sm,&ss);
      scanf("%d:%d:%d",&eh,&em,&es);
      timetable[i]=make_pair(sh*3600+sm*60+ss,eh*3600+em*60+es);
    }
    int ans=0;
    for(int i=0,sti,eti;i<n;++i){
    	int cnt=1;
      sti=timetable[i].first;
      eti=timetable[i].second;
      for(int j=0,stj,etj;j<n;++j){
        if(i==j)continue;
        stj=timetable[j].first;
        etj=timetable[j].second;
        if((sti<=stj&&stj<eti)||(sti<etj&&etj<=eti))++cnt;
      }
      ans=max(ans,cnt);
    }
    cout<<ans<<endl;
  }
  return 0;
}

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 < 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 < 86400; i++) {
			sum += r[i]; r[i] = 0;
			ret = max(ret, sum);
		}
		printf("%d\n", ret);
	}
	return 0;
}