import java.util.ArrayList;
import java.util.Scanner;
//TIP To Run code, press or
// click the icon in the gutter.
public class Main {
public static void main(String[] args) {
ArrayList users = new ArrayList<>();
Scanner sc = new Scanner(System.in);
String input = "";
while (!input.equals("Q")) {
input = sc.nextLine();
if (!input.equals("Q"))
users.add(input);
}
for (String user : users) {
System.out.println(user.length());
}
}
}