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

using namespace std;

void change(char stime[10001][20], int i)
{
	char tmp[20];

	for(int j = i - 1; j >= 0; j--){
		if(strcmp(stime[j], stime[j - 1]) > 0) break;
		else{
			strcpy(tmp, stime[j]);
			strcpy(stime[j], stime[j-1]);
			strcpy(stime[j-1], tmp);
		}
	}
}

int main()
{
	int n;
	char stime[10001][20];
	char gtime[10001][7];
	char div[3] = ":";
	char *tmp;
	int sh[10001], sm[10001], ss[10001];
	int gh[10001], gm[10001], gs[10001];
	int count;

	while(true){
		cin >> n;
		if(n == 0) break;
		count = 0;
		for(int i = 0; i < n; i++){
			cin >> stime[i];
			cin >> gtime[i];
			strcat(stime[i], div);
			strcat(stime[i], gtime[i]);
			//printf("%s\n", stime[i]);
			change(stime, i);
		}

		//sort(stime, stime + n);

		for(int i = 0; i < n; i++){
			//cin >> stime[i];
			//cin >> gtime[i];
			//printf("%s\n", stime[i]);

			tmp = strtok(stime[i], ":");
			sh[i] = atoi(tmp);
			//printf("%d\n", sh[i]);
			tmp = strtok(NULL, ":");
			sm[i] = atoi(tmp);
			//printf("%d\n", sm[i]);
			tmp = strtok(NULL, ":");
			ss[i] = atoi(tmp);
			//printf("%d\n", ss[i]);
			tmp = strtok(NULL, ":");
			gh[i] = atoi(tmp);
			//printf("%d\n", gh[i]);
			tmp = strtok(NULL, ":");
			gm[i] = atoi(tmp);
			tmp = strtok(NULL, ":");
			gs[i] = atoi(tmp);

			if(i == 0) count++;
			else{
			for(int j = 0; j < i; j++){
				/*if((gh[j] > sh[i]) || (gh[j] == sh[i] && gm[j] > sm[i]) || 
						(gh[j] == sh[i] && gm[j] == sm[i] && gs[j] >= ss[i])){
					count++;
					break;
				}*/
				//printf("%d %d\n", gh[j], sh[i]);
				if(gh[j] < sh[i] || (gh[j] == sh[i] && gm[j] < sm[i]) ||
						 (gh[j] == sh[i] && gm[j] == sm[i] && gs[j] <= ss[i])){
							gh[j] = 25;
							//sm[j] = sm[i];
							//ss[j] = ss[i];
							break;
				}
				if(j == i - 1){
					count++;
					//printf("%d %d\n", i, j);
					break;
				}
			}
			}
		}
		cout << count << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <string>

using namespace std;

int time2sec(string s) {
    int hour = stoi(s.substr(0,2), nullptr, 10);
    int minute = stoi(s.substr(3,2), nullptr, 10);
    int sec = stoi(s.substr(6,2), nullptr, 10);

    return hour * 3600 + minute * 60 + sec;
}

int main() {
    int table[24*3600+1];

    int n;
    while (cin >> n, n) {
        fill_n((int *)table, 24*3600+1, 0);
        
        int max = 0;
        for (int i = 0; i < n; i++) {
            string s, e;
            cin >> s >> e;

            int ss = time2sec(s);
            int es = time2sec(e);

            for (int t = ss; t < es; t++) {
                table[t]++;
                if (max < table[t]) {
                    max = table[t];
                }
            }
        }
        cout << max << endl;
    }

    return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define all(v) v.begin(), v.end()
#define fi first
#define se second
using namespace std;
using ll = long long;
using P = pair<int ,int>;
const int INF = 1e9;
const int MOD = 1e9+7;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    while (true) {
        int n; cin >> n;
        if(!n) break;

        vector<int> seconds(24*60*60, 0);
        rep(i, n) {
            string s, t; cin >> s >> t;
            int sh = (s[0]-'0') * 10 + (s[1]-'0');
            int sm = (s[3]-'0') * 10 + (s[4]-'0');
            int ss = (s[6]-'0') * 10 + (s[7]-'0');
            int th = (t[0]-'0') * 10 + (t[1]-'0');
            int tm = (t[3]-'0') * 10 + (t[4]-'0');
            int ts = (t[6]-'0') * 10 + (t[7]-'0');
            seconds[sh*60*60+sm*60+ss] += 1;
            seconds[th*60*60+tm*60+ts] -= 1;
        }

        vector<int> imos(24*60*60+1, 0);
        rep(i, imos.size()) imos[i+1] = imos[i]+seconds[i];
        int ans = 0;
        for(const auto& ss: imos) ans = max(ans, ss);
        cout << ans << endl;
    }
}

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

int main() {
	int n;
	while(cin >>n,n){
		vector<int> vat;
		vat.capacity(n);
		for(int i=0;i<n;i++){
			string lts,ats;		//leave_time_string,arrive_time_string
			cin >>lts>>ats;
		
			lts.erase(lts.begin()+2);
			lts.erase(lts.begin()+4);
			ats.erase(ats.begin()+2);
			ats.erase(ats.begin()+4);
			
			int lt = atoi(lts.data());	//leave_time
			int at = atoi(ats.data());	//arrive_time

			if(i==0){
				vat.push_back(at);
				continue;
			}
			for(int j=0;j<vat.size();j++){
				if(vat[j]<=lt){
					vat[j]=at;
					break;
				}
				if(j==vat.size()-1)	vat.push_back(at);
			}
		}
		cout << vat.size() << endl;
	}
	
	return 0;
}