import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    while(true) {
        string str = readln.chomp;
        if (str == "END OF INPUT") break;
        if (str.all!(a=>a==' ')) {
            writeln(0);
        } else {
            str.split("  ").map!(a => a.split.map!(b => b.length.to!string).reduce!"a~b").reduce!((a, b) => a~"0"~b).writeln;
        }
    }
}