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 <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef  pair<int,int>P;
int main(){
  int n;
  vector<P>ve;
  while(cin >> n,n){
    ve.clear();
    int t,s;
    for(int i = 0 ; i < n ; i++ ){
      int a,b,c;
      char ch;
      cin >> a >> ch >> b >> ch >> c;
      s = a*3600 + b*60 + c;
      cin >> a >> ch >> b >> ch >> c;
      t = a*3600 + b*60 + c;
      ve.push_back(P(t,s));
    }

    sort(ve.begin(),ve.end());

    int ans = 1,p = 0;
    for(int i = 0 ; i < n-1 ; i++ ){
      if(ve[i].first > ve[i+1].second ){ans++;}
      if(ve[p].first <= ve[i+1].second && ans > 1 ){ans--;p++;}
    }
    cout << ans << endl;
  }
  return 0;
}

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

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

class range{
public:
	int left,right;
	range(int left,int right):left(left),right(right){}
	range(){};
};

bool is_connect(range a,range b){
	if(a.right<=b.left || b.right<=a.left) return false;
	return true;
}


int main()
{
	int n;
	while(cin>> n && n!=0){
		vector<range> V(n);
		for(int i=0;i<n;i++){
			string s,t;cin>>s>>t;
			V[i].left=convert(s);
			V[i].right=convert(t);
		}

		int ans[24*3600+60*60+60+1];
		memset(ans,0,sizeof(ans));
		for(int i=0;i<n;i++){
			for(int k=V[i].left;k<V[i].right;k++){
				ans[k]++;
			}
		}

		int res=0;
		for(int i=0;i<=24*3600+60*60+60;i++){
			res=max(res,ans[i]);
		}
		cout<<res<<endl;



	}
	return 0;
}

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

#define rep(i,n) for(int i = 0; i < n; ++i)
#define rec(i,m,n) for(int i = m; i < n; ++i)

using namespace std;

int main()
{

  int n ;
  int Sh,Sm,Ss;
  int Eh,Em,Es;
  int max = -1;
  int Sindex,Eindex;
  vector<int> time(240001);


  while(cin >> n && n!=0)
    {

      fill(time.begin(),time.end(),0);

      rep(i,n){

        scanf("%d:%d:%d %d:%d:%d",&Sh,&Sm,&Ss,&Eh,&Em,&Es);

        Sindex = Sh*10000 + Sm*100 + Ss;
        Eindex = Eh*10000 + Em*100 + Es;

        time[Sindex]++;
        time[Eindex]--;

      }

      rep(i,time.size())
        if(i > 0)
          time[i] += time[i-1];

      rep(i,time.size())
        if(max < time[i])
          max = time[i];

      cout << max << endl;

    }

  return 0;

}

C++: #include<iostream>
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);
    }
    return 0;
}

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

using namespace std;

typedef pair<int, int> P;

P tn[10001];

int main()
{
    int n;

    while (cin >> n, n) {
        int h, m, s;
        char ch;
        int ans = 0;

        for (int i = 0; i < n; i++) {
            cin >> h >> ch >> m >> ch >> s;
            tn[i].first = (h * 60 + m) * 60 + s;
            cin >> h >> ch >> m >> ch >> s;
            tn[i].second = (h * 60 + m) * 60 + s;
        }

        sort(tn, tn + n);
        for (int i = 0; i < n; i++) {
            int tmp = 1;
            for (int j = i + 1; j < n; j++) {
                if (tn[j].first >= tn[i].second)
                    break;
                tmp++;
            }
            ans = max(ans, tmp);
        }
        cout << ans << endl;
    }

    return 0;
}

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