Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	for sc.Scan() {

		str := sc.Text()

		if str == "END OF INPUT" {
			break
		}

		strs := strings.Split(sc.Text(), " ")

		for _, s := range strs {
			fmt.Print(len(s))
		}

		fmt.Println()
	}

}

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>

using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define popcount __builtin_popcount
           
#define rep(i, n) for (int i = 0; i < n; ++i)

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

const double EPS = 1e-10;
typedef long long ll;
typedef pair<int, int> pint;


int main()
{
    string s;
    while (getline(cin, s), s != "END OF INPUT")
    {
	s += " ";
	int c = 0;
	for (int i = 0; i < s.size(); ++i)
	{
	    if (s[i] == ' ')
	    {
		if (c)
		    cout << c;

		if (i && s[i - 1] == ' ')
		    cout << '0';
		c = 0;
	    }
	    else
		++c;
	}
	cout << endl;
    }
}

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

int main()
{
    string str;

    while( getline( cin, str ) )
    {
        if( str == "END OF INPUT" )
            break;

        int cnt = 0;
        for( int i = 0; i < str.size(); i++ )
        {
            if( str[i] != ' ' )
                cnt++;
            else
            {
                cout << cnt;
                cnt = 0;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}