Go: package main

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

func configure(scanner *bufio.Scanner) {
	// scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	for s := getNextString(scanner); s != "END OF INPUT"; s = getNextString(scanner) {
		ss := strings.Split(s, " ")
		for i := 0; i < len(ss); i++ {
			fmt.Fprint(writer, len(ss[i]))
		}
		fmt.Fprintln(writer, "")
	}
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  string s;
  while(1){
    getline(cin,s);
    if(s=="END OF INPUT")break;
    int ans=0;
    s=s+" ";
    rep(i,s.size()){
      if(s[i]==' '){
	cout<<ans;
	ans=0;
      }else{
	ans++;
      }
    }
    cout<<endl;
  }
}

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

using namespace std;

void solve()
{
	string str;
	while(getline(cin, str))
	{
		if(str == "END OF INPUT")
		{
			break;
		}
		int count = 0;
		for(int i = 0; i < str.size(); ++i)
		{
			if(str[i] == ' ')
			{
				cout << count;
				count = 0;
			}
			else
			{
				++count;
			}
		}
		cout << count << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main( void )
{
	string input;
	while ( getline( cin, input ) && input != "END OF INPUT" )
	{
		for ( string::iterator it = input.begin(); it != input.end(); it++ )
		{
			if ( ( *it >= 'A' && *it <= 'Z' ) || ( *it >= 'a' && *it < 'z' ) ) *it = 'a';
		}

		string answer = "";
		char prev = ' ';
		int length = 0;
		for ( string::iterator it = input.begin(); it != input.end(); it++ )
		{
			char& now = *it;
			if ( it != input.begin() && now == ' ' && prev == ' ' )
			{
				answer += '0';
				while ( it != input.end() && *it != 'a' ) it++;
				it--;
			}
			else if ( now == 'a' )
			{
				length++;
			}
			else if ( now == ' ' && prev == 'a' )
			{
				answer += ( '0' + length );
				length = 0;
			}
			prev = now;
		}
		if ( length ) answer += ( '0' + length );

		cout << answer << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>

#define LP(i,n) for(int i=0;i<n;i++)
#define Mset(x,v) memset(x,v,sizeof(x))
#define INF INT_MAX

using namespace std;
using LL=long long;

int main(){
    string s;
    while(1){
        getline(cin,s);
        if(s=="END OF INPUT") break;
        int c=0;
        LP(i,s.size()+1){
            if(s[i]==' '||i==s.size()){
                cout<<c;
                c=0;
            }
            else c++;
        }
        cout<<endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    string S;
    
    while(true)
    {
        S = "";
        
        while(S == "")
        {
            getline(cin, S);
        }
        
        if(S == "END OF INPUT") { break; }
        
        int count_ = 0;
        
        for(int i = 0; i < S.size(); i++)
        {
            if(S[i] == ' ')
            {
                cout << count_ << endl;
                
                count_ = 0;
            }
            else
            {
                count_++;
            }
        }
        
        cout << count_ << endl;
    }
    
    return 0;
}