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 <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string str;
  while(getline(cin,str)){
    if(str == "END OF INPUT") break;
    ll cnt = 0,f = 0;
    rep(i,str.size()){
      if(str[i] != ' '){
        ++cnt;
      }
      else{
        if(cnt || !f){
          cout << cnt;
        }
        f = !f;
        cnt = 0;
      }
    }
    if(cnt)
      cout << cnt << endl;
    else cout << endl;
  }
  return 0;
}

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

    for(int i = 0 ; i < c + 1 ; i++){
      int cnt = 0;
      while(1){
	if(s[ii] == '_') break;
	ii++;
	cnt++;
      }
      ii++;
      //cout << "OK" << endl;
      ans[i] = cnt;
    }

    for(int i = 0 ; i < c + 1; i++){
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
	while(true)
	{
		string str;
		char tmp;
		while(true){
			cin.get(tmp);
			if(tmp == '\n') break;
			str += tmp;
		}
		if(str == "END OF INPUT") break;
		str += ' ';

		string output = "";
		int cnt = 0;
		int len = str.size();
		for(int i=0; i < len; i++) {
			if(str[i] == ' ') {
				output += (char)('0' + cnt);
				cnt = 0;
			}
			else
				cnt++;
		}
		cout << output << 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();
        n--;
        int cnt = 0;
        VI L;
        for ( int i = 0; i < n; ++ i ) {
            if ( s[i] == ' ' ) {
                if ( cnt == 0 && i + 1 < n && s[i+1] == ' ' ) {
                    L.push_back( 0 );
                } else if ( cnt > 0 ) {
                    L.push_back( cnt );
                }
                cnt = 0;
            } else {
                cnt ++;
            }
        }
        if ( cnt == 0 && n >= 2 && s[n-1] == ' ' && s[n-2] == ' ' ) L.push_back( 0 );
        else if ( cnt > 0 ) 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++: #include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <sstream>
using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

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

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

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define it ::iterator
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double ESP=1e-10;
using namespace std;
int main(){
  while(1){
    char s[10000]={'\0'};
    gets(s);
    if(!strcmp(s,"END OF INPUT"))break;
    int n=0;
    rep(i,10000){if(s[i]=='\0')break;n++;}
    //cout<<n<<endl;
    int co=0;
    rep(i,n){
      if(s[i]==' '){cout<<co;co=0;}
      else co++;
    }
    cout<<co<<endl;
  }
}

C++: #include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (int)(a); v < (int)(b); ++v)
#define FORE(v, a, b) for(int v = (int)(a); v <= (int)(b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
using namespace std;

void split(string str, char chr, vector< string > *res){
	stringstream ss(str);
	string itm;
	while(getline(ss, itm, chr)){
		(*res).PB(itm);
	}
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string str;
	vector< string > words;
	
	while(getline(cin, str), str != "END OF INPUT"){
		words.CLR();
		split(str, ' ', &words);
		REP(i, words.size()){
			cout << words[i].length();
		}
		cout << endl;
	}
	
	return 0;
}