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 <sstream>
#include <string>
using namespace std;
int main( void )
{
	string input;
	while ( getline( cin, input ) && input != "END OF INPUT" )
	{
		for ( string::iterator it = input.begin(); it != input.end(); it++ )
		{
			if ( ( *it >= 'A' && *it <= 'Z' ) || ( *it >= 'a' && *it < 'z' ) ) *it = 'a';
		}

		string answer = "";
		char prev = ' ';
		int length = 0;
		for ( string::iterator it = input.begin(); it != input.end(); it++ )
		{
			char& now = *it;
			if ( it != input.begin() && it+1 != input.end() && *(it+1) == ' ' && now == ' ' && prev == ' ' )
			{
				answer += '0';
				while ( it != input.end() && *it != 'a' ) it++;
				it--;
			}
			else if ( now == 'a' )
			{
				length++;
			}
			else if ( now == ' ' && prev == 'a' )
			{
				answer += ( '0' + length );
				length = 0;
			}
			prev = now;
		}
		if ( length ) answer += ( '0' + length );

		cout << answer << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
  int k;
  vector<int> data;
  string str, _str;
  string::iterator i, j;

  while(1){
    getline(cin, str);
    if(str == "END OF INPUT") break;

    i = str.begin();
    while(1){
      j = find(i, str.end(), ' ');
      copy(i, j, back_inserter(_str));
      data.push_back(_str.size());
      _str.clear();
      if(j == str.end()) break;
      i = j+1;
    }

    for(k=0; k<data.size(); ++k)
      cout << data[k];
    cout << endl;

    data.clear();
  }

  return 0;
}

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

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

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

int main(){

	while (true){
		std::string str;
		std::getline(std::cin, str);

		if (str == "END OF INPUT")break;

		int cnt = 0;
		for (int i = 0; i < str.size(); i++){
			if (str[i] == ' ')std::cout << cnt, cnt = 0;
			else cnt++;
		}
		std::cout << cnt << std::endl;
	}

	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 TEXT")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 <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 ( i > 0 && s[i-1] == ' ' ) {
                    L.push_back( 0 );
                } else if ( cnt > 0 ) {
                    L.push_back( cnt );
                }
                cnt = 0;
            } else {
                cnt ++;
            }
        }
        if ( cnt == 0 && n > 1 && 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 <sstream>
//#include <fstream>

using namespace std;

string itos (int n )
{
	stringstream ss;
	ss << n;

	return ss.str();
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.yesnumber", "r", stdin );
	string str = "";
	
	while (getline (cin, str ) ){
		string res = "";
		if (str == "END OF INPUT" ){
			break;
		} // end if
		int len = str.length();
		str += '_';
		int count = 0;

		for (int i = 0; i < len; ++i){
			if (str[i] != ' ' && str[i+1] != ' ' ){
				++count;
			}else if (str[i] != ' ' && str[i+1] == ' '){
				++count;
				res += itos(count);
				count = 0;
			}else if (str[i] == ' ' && str[i+1] == ' '){
				res += itos (0);
				count = 0;
			} // end if
		} // end for
		if (count != 0 ){
			res += itos (count);
		} // end if

		cout << res << endl;	
	} // end loop
		
	return 0;
}

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

int main() {
    string s;
    while (getline(cin, s)) {
        if (s == "END OF INPUT") break;
        int count = 0;
        char before;
        string ans;
        for (string::iterator si = s.begin(); si != s.end(); si++) {
            switch (*si) {
                case ' ':
                    if (before == ' ') {
                        ans.push_back(count+'0');
                        count = 0;
                        continue;
                    } else {
                        ans.push_back(count+'0');
                        count = 0;
                    }
                    break;
                default:
                    before = *si;
                    count++;
                    break;
            }
        }
        ans.push_back(count+'0');
        cout << ans << endl;
    }
    return 0;
}