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>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
#include <map>
#include <sstream>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-9

int main(){
	string in;
	while(getline(cin,in),in!="END OF INPUT"){
		int cnt;
		for(int i=0; i<in.size();){
			cnt = 0;
			for(;i<in.size() && in[i++]!=' ';cnt++);
			if( i==in.size() )cnt--;
			printf("%d",cnt);
		}
		puts("");
	}
	return 0;
}

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

typedef string::iterator S;

int main(){
    string s;
    while( getline(cin, s), s != "END OF INPUT" ){
        for(S it = s.begin();;it++){
            int count = 0;
            while( it != s.end() && *it != ' ' ){
                it++; count++;
            }
            cout << count;
            if( it == s.end() ) break;
        }
        cout << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
char t[1001];
int size,n,tmp,cnt,a,b,c,x,y,z,flg;
int endofinput(){
  if(t[12]!='\n')return 0;
  if(t[0]!='E')return 0;
  if(t[1]!='N')return 0;
  if(t[2]!='D')return 0;
  if(t[3]!=' ')return 0;
  if(t[4]!='O')return 0;
  if(t[5]!='F')return 0;
  if(t[6]!=' ')return 0;  if(t[9]!='P')return 0;
  if(t[7]!='I')return 0;  if(t[10]!='U')return 0;
  if(t[8]!='N')return 0;  if(t[11]!='T')return 0;
  return 1;
}
int main(){
  while(1){
    size=0;
    while(1){
      scanf("%c",&t[size]);
      size++;
      if(t[size-1]=='\n')break;
    }
    if(endofinput())break;
    cnt=0;
    flg=0;
    if(t[0]!=' ')cnt=1;
    for(int i=1;i<size-1;i++){
      if(t[i]==' '){
	cout<<cnt;
	cnt=0;
	flg=1;
      }else{
	cnt++;
	flg=0;
      }
    }
    cout<<cnt<<endl;
  }

  return 0;
}

C++: //https://onlinejudge.u-aizu.ac.jp/problems/1042

#include <bits/stdc++.h>

using namespace std;

int main() {
    while (true) {
        string s;
        getline(cin, s);
        if (s == "END OF INPUT") return 0;

        stringstream ss;
        ss << s;
        string buf;
        while (getline(ss, buf, ' ')) {
            cout << buf.length();
        }
        cout << endl;
    }
}

/*
 * getlineで空白を含む文字列を行ごとに取得。
 * stringstreamで空白で区切った文字列を作る。
 */

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

using namespace std;

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

C++: #include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	int h,i,pre,j;
	char s[400];
	while(1){
		fgets(s,300,stdin);
		if(strcmp(s,"END OF INPUT\n")==0)
		break;
		pre=0;
		h=strlen(s);
		for(i=0;i<h+1;i++){
			if(s[i]==' '){
					printf("%d",i-pre);
					pre=i+1;
					if(s[i+1]==' '){
					printf("0");
					i++;
					pre++;
				}
			}
			else if(s[i]=='\n'){
				printf("%d",i-pre);
				break;
			}
		}
		printf("\n");
		
	}
	
	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;

    if (s.find_first_of("\n") != string::npos)
      s.erase(s.end()-1);
    if (s.find_first_of("\r") != string::npos)
      s.erase(s.end()-1);
    
    stringstream ss(s);
    while (ss >> s)
      cout << s.size();
    cout << endl;
  }
  return 0;
}

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

using namespace std;

int main()
{
  string str("END OF INPUT");
  int size;

  while(1){
    size = 0;
    string v;
    getline(cin,v);

    if(v == str){
      break;
    }

    for(char e : v){
      if(e == ' '){
        cout<<size;
        size = 0;
      }
      else{
        size++;
      }
    }
    cout<<size<<endl;
  }
  return 0;
}

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

using namespace std;
int main() {
	string s;
	while (getline(cin, s), s == "END OF INPUT") {
		for (int i = 0, n = 0; i < s.length; i++) {
			if (i == s.length -1 || s[i] == ' ') {
				cout << n;
			} else {
				n++;
			}
		}
		cout << endl;
	}
	return 0;
}

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

using namespace std;

int main() {
	string b;
	while (getline(cin, b)) {
		if (b == "END OF INPUT") {
			break;
		}
		int counter = 0;
		bool hantei = false;
		for (int i = 0; i < b.size(); i++) {
			if (b[i] == ' ') {
				if (i != 0 && b[i-1] != ' ') {
					cout << counter << flush;
					counter = 0;
				} else {
					cout << 0;
					i++;
				}
			} else {
				counter++;
			}
		}
		cout << counter << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<string>
using namespace std;
string S, T; int chain;
int main() {
	while (true) {
		getline(cin, S);
		S += ' ';
		T = "";
		if (S == "END OF INPUT ") { break; }
		for (int i = 0; i < S.size(); i++) {
			if (S[i] != ' ') { chain++; }
			else { T += to_string(chain); chain = 0; }
		}
		cout << T << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define REP(i,b,n) for(i=b;i<n;i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))

using namespace std;

int main()
{
	string s;
	while(getline(cin, s), s != "END OF INPUT")
	{
		int i, d = 0;
		
		REP(i, 0, s.size())
		{
			if( s[i] == ' ')
			{
				cout << i-d;
				d = i+1;
			}
		}
		
		cout << i-d << 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"){
        stringstream ss(s);
        string t;
        while(ss >> t){
            cout << t.size();
        }
        cout << endl;
    }
}

C++: #include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
using namespace std;

int main(){
	int n,m;
	char str[10000];
	while(1){
		fgets(str,1000,stdin);
		if(strcmp(str,"END OF INPUT\n")==0) break;
		m=0;
		for(n=0;;n++){
			if(str[n]==' '){
				printf("%d",m);
				m=-1;
			}
			if(str[n]=='\n'){ 
				printf("%d",m);
				break;
			}
			m++;
		}
		printf("\n");
	}
	
	
	return 0;
}