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

using namespace std;

int main(int argc, char *argv[]) {
  string s;
  while (true) {
    getline(cin, s);
    if (s == "END OF INPUT")
      break;
    string result;
    int count = 0;
    for (int i = 0; i < s.size(); i++) {
      if (('a' <= s[i] && s[i] <= 'z') ||
          ('A' <= s[i] && s[i] <= 'Z')) {
        count++;
      } else if (count == 0 && s[i] == ' ') {
        result += '0';
      } else if (s[i] == ' ') {
        result += (char)(count+'0');
        count = 0;
      }
    }
    result += (char)(count+'0');

    cout << result << 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"){
        if(s.size()==0){
            cout << 0 << endl;
            continue;
        }
        stringstream ss(s);
        string t;
        while(ss >> t){
            cout << t.size();
        }
        cout << endl;
    }
}

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

using namespace std;

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

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

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

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

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

using namespace std;

int main(){
  string str;
  while(cin >> 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 <bits/stdc++.h>
using namespace std;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

vector<string> sp(string s) {
  vector<string>r;
  int idx=0;
  rep (i, s.size()) {
    if (s[i] == ' ') {
      r.push_back(s.substr(idx, i - idx));
      idx = i + 1;
    }
  }
  r.push_back(s.substr(idx,s.size()));
  return r;
}

int main() {

  for (string s;;) {
    getline(cin, s);
    if (s == "END OF INPUT") break;
    auto v = sp(s);
    for (string w : v) {
      cout << w.size();
    } cout << endl;
  }

  return 0;
}

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

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

C++: #include<iostream>
#include<string>
using namespace std;
int main(void){
  string str,ans;
  for(;;){
    getline(cin,str);
    if(str=="END OF INPUT") break;
    ans.clear();
    for(int i=0;i<str.size();i++){
      if(i==0 && str[i]==' ' || str[i-1]==' ' && str[i]==' ') ans+='0';
      else if(str[i-1]==' ' || i==0){
	char c=0;
	for(int j=i;;j++){
	  if(str[j]==' ' || j==str.size()) break;
	  c++;
	}
	ans+=c+48;
      }
    }
    cout << ans << endl;
  }
}