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 <algorithm>
using namespace std;

const int TIME = 60 * 60 * 24 + 60;
int data[TIME];

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	while(cin >> n && n != 0){
		for(int i = 0; i < TIME; ++i){
			data[i] = 0;
		}
		
		int a, b, c;
		for(int i = 0; i < n; ++i){
			scanf("%d:%d:%d", &a, &b, &c);
			data[a * 60 * 60 + b * 60 + c] ++;
			
			scanf("%d:%d:%d", &a, &b, &c);
			data[a * 60 * 60 + b * 60 + c] --;
		}
	
		int ans = 0;
		for(int i = 0; i < TIME; ++i){
			if(i > 0)
				data[i] += data[i - 1];
			ans = max(ans, data[i]);
		}
		
		cout << ans << endl;
	}
	return 0;
}

C++: #include "bits/stdc++.h"
using namespace std;
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvl vector<vector<ll>>
#define print(n) cout<<n<<endl
const int M=100010;
const int MOD=1000000007;
const int inf=1000000007;
const long long INF=1000000000000000007;
using ll=long long;
//int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};



int main(){
	int n;
	const int MAX=10010;
	while(1){
		int ans_1[MAX],ans_2[MAX],cnt=0,ans=0;
		cin>>n;
		if(n==0)break;
		string s;
		rep(i,0,n){
			cin>>s;
			ans_1[i]=(int)((s[0]-'0')*10+s[1]-'0')*3600+(int)((s[3]-'0')*10+s[4]-'0')*60+(int)((s[6]-'0')*10+s[7]-'0');
			cin>>s;
			ans_2[i]=(int)((s[0]-'0')*10+s[1]-'0')*3600+(int)((s[3]-'0')*10+s[4]-'0')*60+(int)((s[6]-'0')*10+s[7]-'0');
		}
		int a[90000]={};
		rep(i,0,n)a[ans_1[i]]++,a[ans_2[i]]--;
		rep(i,0,90000)if(a[i]!=0)cnt+=a[i],ans=max(ans,cnt);
		print(ans);
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> p;

int atooi(char s){
  string n="0123456789";
  for(int i=0;i<=10;i++){
    if(s==n[i]){
      return i;
    }
  }
  return 0;
}

int timetime(string s){
  int hh,mm,ss,st,ft,h1,h2,m1,m2,s1,s2;
  h1= atooi(s[0]);
  h2= atooi(s[1]);
  m1= atooi(s[3]);
  m2= atooi(s[4]);
  s1= atooi(s[6]);
  s2= atooi(s[7]);
  hh=h1*10+h2;
  mm=m1*10+m2;
  ss=s1*10+s2;
  st=hh*3600+mm*60+ss;
  return st;
}

int main(){
  while(true){
  int n,st,ft;
  cin>>n;
  if(n==0) return 0;
  int  tm[100000]={};
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    st =timetime(s);
    tm[st]+=1;
   cin>>s;
   ft=timetime(s);
    tm[ft]-=1;
  }

  int val=0,ans=0;
  for(int i=0;i<=89899;i++){
    tm[i]+=val;
    val=tm[i];
    ans=max(ans,tm[i]);
  }
  cout<<ans<<endl;
}
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>


using namespace std;

const int INF=1e+8;

typedef struct{
	int start,end;
	bool labelFlag;
}jikan;

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


//比較関数
int comp(const void *c1,const void *c2){
	jikan jikan1=*(jikan *)c1;
	jikan jikan2=*(jikan *)c2;
	
	int tmp1=jikan1.start;
	int tmp2=jikan2.start;
	
	return tmp1-tmp2;
}

int main(){
	int n,cnt,ans;
	int h,m,s;
	jikan interval[10000];
	
	
	while(cin>>n,n){
		cnt=1;
		ans=1;
		for(int i=0;i<10000;i++){
			interval[i].start=INF;
			interval[i].end=INF;
			interval[i].labelFlag=false;
		}
		
		for(int i=0;i<n;i++){
			scanf("%d:%d:%d",&h,&m,&s);
			interval[i].start=jikanShori(h,m,s);
			scanf("%d:%d:%d",&h,&m,&s);
			interval[i].end=jikanShori(h,m,s);
		}
		
		qsort(interval,10000,sizeof(jikan),comp);
		
		for(int i=0;i<n;i++){
			cnt=1;
			//if(!interval[i].labelFlag){
				//interval[i].labelFlag=true;
				for(int j=i+1;j<n;j++){
					if(interval[i].end>interval[j].start){
						cnt++;
						//interval[j].labelFlag=true;
					}
				}
			//}
			ans=max(ans,cnt);
		}
		
		cout<<ans<<endl;
	}
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#define INF 1 << 28
using namespace std;

typedef pair<int,int> P;

int main ()
{
    int n;
    while (cin >> n, n) {
        string str1, str2;
        vector<P> time;
        while (n--) {
            cin >> str1 >> str2;
            for (int i = 0; i < str1.size(); i++) {
                if (str1[i] == ' ') {
                    str1[i] = str2[i] = ' ';
                }
            }

            stringstream ss1, ss2;
            ss1 << str1;
            ss2 << str2;

            int t1, t2, t3;
            ss1 >> t1 >> t2 >> t3;
            int s = t1 * 60 * 60 + t2 * 60 + t3;
            ss2 >> t1 >> t2 >> t3;
            int e = t1 * 60 * 60 + t2 * 60 + t3;

            time.push_back(P(s,e));
        }

        time.push_back(P(INF,INF));
        vector<int> st, et;
        for (int i = 0; i < time.size(); i++) {
            st.push_back(time[i].first);
            et.push_back(time[i].second);
        }

        int k = 0, l = 0;
        int tmp = 0, MAX = 0;
        while (st[k] != INF || et[l] != INF) {
            if (st[k] < et[l]) {
                tmp++;
                k++;
            } else {
                tmp--;
                l++;
            }
            MAX = MAX < tmp ? tmp : MAX;
        }

        cout << MAX << endl;
    }

    return 0;
}