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 <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  string str;
  
  while(getline(cin, str)){
    if(str == "END OF INPUT") break;
    
    string ans = "";
    int cnt = 0;
    
    for(int i = 0 ; i < str.size() ; i++){
      if(i == str.size()-1) ans += cnt+1 + '0';
      else if(str[i] != ' ') cnt++;
      else{
	ans += cnt + '0';
	cnt = 0;
      }
    }
    cout << ans << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <string>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>

#define PI 3.14159265359

#define INF 99999999;

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

typedef long long ll;

using namespace std;



/*
class LightSwitchingPuzzle
{
public:
	int minFlips(string s)
	{

	}
}
*/


int get_num(string inp)
{
	int ret = 0;
	
	for (int i=0; i<inp.length(); i++)
	{
		if (inp[i] == ' ')
		{
			return ret;
		} else {
			ret++;
		}
	}
}


int main()
{
	string inp;
	int num;
	
	while (getline(cin, inp))
	{
		if (inp == "END OF INPUT") break;
		
		inp += " ";
		
		while (inp != "")
		{
			num = get_num(inp);
			cout << num;
			inp = inp.substr(num+1);
		}
		
		cout << endl;
	}
	
	return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int main() {
	string s;
	while (getline(cin, s), s != "END OF INPUT") {
		string res;
		s += ' ';
		replace(s.begin(), s.end(), ' ', '+');
		stringstream ss(s);
		char c;
		int cnt = 0;
		while (ss >> c) {
			if (c == '+') {
				res += to_string(cnt);
				cnt = 0;
			}
			else cnt++;
		}
		cout << res << endl;
	}
}

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 <bits/stdc++.h>

using namespace std;

template <typename T>
using vec1 = vector<T>;

constexpr auto cin2line([] {
    string s;
    getline(cin, s);
    return s;
});

vec1<string> Split(const string& str, char sep)
{
    vec1<string> v;
    stringstream ss(str + sep);
    string       line;
    while (getline(ss, line, sep)) {
        v.push_back(line);
    }
    return v;
}

int main()
{
    while (true) {
        const string S(cin2line());
        if (S == "END OF INPUT") break;
        const auto strs(Split(S, ' '));
        for (const auto& str : strs) {
            cout << str.size();
        }
        cout << endl;
    }
    return 0;
}

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