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):
 num = 100009
 time = [0]*num

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

 for i in range(n):
  t = list(input().split())
  a_,b_ = t[0].split(':'),t[1].split(':')
  a = int(a_[0])*3600+int(a_[1])*60+int(a_[2])
  b = int(b_[0])*3600+int(b_[1])*60+int(b_[2]) -1
  #print(a)
  #print(b)

  time[a] += 1
  time[b+1] -= 1

 ans = 1
 for i in range(num):
  if(i != 0): time[i] += time[i-1]
  ans = max(ans,time[i])
 print(ans)

Python: 
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

def calc(t):
    h,m,s = map(int,t.split(':'))
    return (h*60+m)*60+s


while True:
    n = inp()
    if n == 0:
        break
    else:
        imos = [0]*(60*60*24+5)
        for _ in range(n):
            ts,tt = input().split()
            ts = calc(ts)
            tt = calc(tt)
            imos[ts] += 1
            imos[tt] -= 1

        tmp = 0
        for i in range(60*60*24+5):
            tmp += imos[i]
            imos[i] = tmp
        print(max(imos))

Python: def to_second(t):
  res = 0
  hour,minute,second = t.split(":")
  res += int(hour)*60*60
  res += int(minute)*60
  res += int(second)
  return res

while True:
  N = int(input())
  if N == 0: exit()
  times = [0] * (24*60*60)
  for _ in range(N):
    s,t = map(str,input().split())
    times[to_second(s)] += 1
    times[to_second(t)] -= 1

  for t in range(24*60*60-1):
    times[t+1] += times[t]

  print(max(times))

Python: 
while True:
    N = int(input())
    if N==0:
        exit()

    MAX_T = 24*3600+10
    S = [0]*MAX_T
    for _ in range(N):
        start, end = input().split()
        a, b,c = map(int, start.split(":"))
        d,e,f  = map(int, end.split(":"))
        # imos
        S[a*3600+b*60+c] += 1
        S[d*3600+e*60+f] -= 1

        # cumsum
    for i in range(MAX_T-1):
        S[i+1] += S[i]
    print(max(S))

Python: while True:
    N = int(input())
    if N == 0: break
    times = []
    for i in range(N):
        a,b = input().split()
        at = int(''.join(a.split(':')))
        bt = int(''.join(b.split(':')))
        times.append((at,1))
        times.append((bt,-1))
    ans = n = 0
    for t,d in sorted(times):
        n += d
        ans = max(ans,n)
    print(ans)

Python: #!/usr/bin/env python3
from itertools import accumulate

T = 86400


def sec(a):
    return 3600 * a[0] + 60 * a[1] + a[2]


while True:
    n = int(input())
    if n == 0:
        exit()
    imos = [0] * T
    for _ in range(n):
        s, t = map(lambda x: list(map(int, x.split(':'))), input().split())
        imos[sec(s)] += 1
        imos[sec(t)] -= 1
    imos = list(accumulate(imos))
    print(max(imos))

Python: for i in range(10**6):
    N=int(input())
    if N==0:
        exit()
    D={}
    for j in range(N):
        s,g=input().split()
        S=s.split(":")
        G=g.split(":")
        ST=int(S[0])*60*60+int(S[1])*60+int(S[2])
        GT=int(G[0])*60*60+int(G[1])*60+int(G[2])
        if ST not in D:
            D[ST]=1
        else:
            D[ST]+=1
        if GT not in D:
            D[GT]=-1
        else:
            D[GT]-=1
    LD=list(D.items())    
    LD.sort()
    MAX=0
    cnt=0
    for t,c in LD:
        cnt+=c
        if MAX<cnt:
            MAX=cnt
    print(MAX)
    #print(LR)

Python: # http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2013
from itertools import accumulate
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    while True:
        n = int(readline())
        if n == 0:
            break

        table = [0] * 87000
        for _ in range(n):
            s_hms, t_hms = readline().split()
            s = int(s_hms[0:2]) * 3600 + int(s_hms[3:5]) * 60 + int(s_hms[6:8])
            t = int(t_hms[0:2]) * 3600 + int(t_hms[3:5]) * 60 + int(t_hms[6:8])

            table[s] += 1
            table[t] -= 1
        
        A = accumulate(table)
        ans = max(list(A))
        print(ans)


if __name__ == "__main__":
    main()

Python: while True:
    n = int(input())
    if n == 0:
        break
    times = [[0] * 2 for i in range(n)]
    for i in range(n):
        l, a = input().split()
        lh, lm, ls = map(int, l.split(":"))
        ah, am, ass = map(int, a.split(":"))
        times[i][0] = lh * 3600 + lm * 60 + ls
        times[i][1] = ah * 3600 + am * 60 + ass
    times.sort(key=lambda x: x[1])
    ans = 1
    arrive = times[0][1]
    idx = 1
    for i in range(1, n):
        if times[idx][1] < arrive:
            arrive = times[idx][1]
            idx += 1
        if times[i][0] < arrive:
            arrive = times[i][1]
            ans += 1
    print(ans)

Python: def time_to_int(t):
    hh, mm, ss = map(int, t.split(':'))
    return hh*3600 + mm*60 + ss

from itertools import accumulate
def solve(n):
    res = [0]*(24*3600+1)
    for _ in range(n):
        s, t = map(time_to_int, input().split())
        res[s] += 1
        res[t] -= 1
    
    ress = accumulate(res)
    print(max(ress))

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