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++: import java.io.*;
public class aoj1042 {
   public static void main(String[] args) throws IOException{
	   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	   String s;
	   while(true){
		   s = br.readLine();
		   if(s.equals("END OF INPUT")) break;
		   String[] ss = s.split(" ");
		   for(int i=0;i<ss.length;i++) System.out.print(ss[i].length());
		   System.out.println();
	   }
   }
}

C++: #include <iostream>
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] == ' '){
	cout << cnt;
	cnt = 0;
      }else cnt++;
    }
      cout << cnt << endl;
  }
}

C++: #include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<deque>
using namespace std;

int main() {

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

        bool afterspace = true;
        int count = 0;
        for(int i = 0; i < line.length(); i++) {
            if ( line[i] != ' ' ) {
                afterspace = false;
                count += 1;
            } else {
                if(!afterspace) {
                    cout << count;
                    count = 0;
                } else {
                    cout << "0";
                    count = 0;
                }
            }
        }
        cout << count << endl;
    }

    return 0;
}

C++: // AOJ 1042
#include<iostream>
#include<sstream>
#include<string>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int main()
{
	std::string s;
	while( std::getline( std::cin, s ), s != "END OF INPUT" )
	{
		int cnt = 0;
		bool fl = false;

		rep( i, s.size() )
		{
			if( fl && s[i] == ' ' )
				std::cout << char(cnt+'0');
			else if( !fl && s[i] == ' ' )
				std::cout << char(cnt+'0'), cnt = 0, fl = true;
			else
				++cnt, fl = false;
		}
		
		std::cout << cnt << std::endl;
	}

	return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>

#define rep(i, j) FOR(i, 0, j)
#define FOR(i, j, k) for(int i = j; i < k; ++i)

using namespace std;

int main(){
  char buf[1000], *s, end[16];
  strcpy(end, "END OF INPUT");
  while(fgets(buf, sizeof(buf), stdin)){
    if(strcmp(buf,end)==0) break;
    s = strtok(buf, " \n");
    while(s != NULL){
      printf("%d", (int)strlen(s));
      s = strtok(NULL, " \n");
    }
    puts("");
  }
  return 0;
}

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

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

using namespace std;

vector<string> split(const string &s)
{
	vector<string> v;

	string buf = "";
	rep(i,s.length())
	{
		if (s[i] == ' ')
		{
			v.push_back(buf);
			buf = "";
		}
		else
		{
			buf += s[i];
		}
	}
	if (!buf.empty()) v.push_back(buf);
	return v;
}

int main()
{
	string str;
	while(getline(cin, str), str != "END OF INPUT")
	{
		vector<string> words = split(str);
		rep(i,words.size())
		{
			cout << words[i].length();
		}
		cout << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	string s,ans;
	while(1){
		getline(cin,s);
		ans="";
		if(s=="END OF INPUT")break;
		int start=0,end;
		if(s==" "){
			cout<<0<<endl;
		}else{
			for(int i=0;i<s.size();i++){
				if(s[i]==' ' || i==s.size()-1){
					if(i==s.size()-1)end=i+1;
					else end=i;
					if(end-start)ans+=(char)(end-start+'0');
					else{
						if(ans[ans.size()-1]!='0')ans+='0';
					}
					start=end+1;
				}
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s;

int main(){
	while (getline(cin, s)){
		if (s == "END OF INPUT")break;
		bool f = 1;
		REP(i, s.size()){
			if (s[i] != ' ')f = 0;
		}
		if (f)cout << 0 << endl;
		string buf;
		stringstream ss;
		ss << s;
		while (ss >> buf){
			cout << buf.size();
		}
		cout << endl;
	}
}

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

using namespace std;

int main(){
  string str;
  while(cin >> str){
    if(str == "END_OF_INPUT") break;
    str += " ";
    int idx = 0;
    while(idx < str.size()){
      int cnt = 0;
      while(str[idx++]!=' ') cnt++;
      cout << cnt;
    }
    cout << endl;
  }
}