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++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

vector<string> split(const string &s, char delim) {
  vector<string> xs;
  string item;
  for (char ch : s) {
    if (ch == delim) {
      if (!item.empty()) {
        xs.push_back(item);
      }
      item.clear();
    } else {
      item += ch;
    }
  }
  if (!item.empty()) {
    xs.push_back(item);
  }
  return xs;
}

void solve() {
  string s;
  while (getline(cin, s), s != "END OF INPUT") {
    vs v = split(s, ' ');
    for (auto &x : v) cout << x.size();
    cout << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;

int main() {
    string str;
    while (getline(cin, str)) {
        if (str[str.size()-1] == '\n') str.resize(str.size()-1);
        if (str == "END OF INPUT") break;
        stringstream ss;
        ss << str;
        string s;
        while (ss >> s) cout << s.size();
        cout << endl;
    }

    return 0;
}

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

const string eof = "END OF INPUT";
typedef vector <string> VS;
typedef vector <int> VI;
typedef istringstream ISS;

int main() {
    string line;
    while ( getline( cin, line ) ) {
        if ( line == eof ) break;
        string s = line;
        int n = s.size();
        int cnt = 0;
        VI L;
        for ( int i = 0; i < n; ++ i ) {
            cnt = 0;
            for ( ; i < n; ) {
                if ( s[i] == ' ' ) break;
                cnt ++;
                i ++;
            }
            L.push_back( cnt );
        }
        for ( VI::iterator it_i = L.begin(); it_i != L.end(); ++ it_i ) {
            cout << *it_i;
        }
        cout << endl;
    }
	return 0;
}

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