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>
using namespace std;string s;int main(){for(;getline(cin,s),s!="END OF INPUT";){int j,i,m=int(s.size());for(j=i=0;i<m;i++){if(s[i]==' '){cout<<i-j;j=i+1;}}cout<<m-j<<endl;}}

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

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

C++: #include<cstdio>
#include<cstring>
using namespace std;
int main(){
	char s[1000];
	int n,i;
	for(;gets(s),strpbrk(s,"END OF INPUT");)
		for(n=i=0;i<strlen(s);i++)
			i==strlen(s)-1?printf("%d\n",n+1):s[i]==' '?printf("%d",n),n=0:n++;
}

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;
		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>

using namespace std;

int main(){
  string str;
  while(getline(ciin, str)){
    if(str == "END OF INPUT") break;
    int idx = 0;
    while(idx < str.size()){
      int cnt = 0;
      while(idx < str.size() && str[idx++]!=' ') cnt++;
      cout << cnt;
    }
    cout << endl;
  }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-9

int main(){
	string in;
	while(getline(cin,in),in!="END OF INPUT"){
		int cnt;
		for(int i=0; i<in.size();i++){
			cnt = 0;
			for(;i<in.size() && in[i]!=' ';i++,cnt++);
			//if( i==in.size() )cnt--;
			printf("%d",cnt);
		}
		puts("");
	}
	return 0;
}

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

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

    int count = 0;
    vector<int> num;
    for (int i = 0; i < s.size(); i++) {
      if(s[i]==' ') {
	num.push_back(count);
	count = 0;
      }
      else count++;
    }
    num.push_back(count);

    for (int i = 0; i < num.size(); i++) {
      cout << num[i];
    }
    cout << endl;
  }
    
  return 0;
}

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

int main()
{
	std::string s;
	while( std::getline( std::cin, s ), s != "END OF INPUT" )
	{
		std::istringstream iss( s );

		int prv = 0;
		repi( i, 1, s.size() )
		{
			if( s[i] == ' ' )
			{
				std::cout << i-prv;
				prv = i+1;
			}
		}

		if( prv != s.size()-1 )
			std::cout << s.size()-prv;

		std::cout << 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[1001];
  char *p;
  while(1){
    fgets(buf, 1001, stdin);
    buf[strlen(buf)-1] = '\0';
    if(strcmp(buf,"END OF INPUT")==0) break;
    printf("%d", strlen(strtok(buf, " ")));
    while((p = strtok(NULL, " ")) != NULL){
      printf("%d", strlen(p));
    }
    puts("");
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
string s;
while(getline(cin,s) && s != "END OF INPUT"){
int a=0;
for(int i=0;i<(int)s.size();i++){if(s[i]==' '){cout << a;a=0;}else a++;}
cout << a << endl;
}
}