1. 

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 10922 2the9s
*
* @author Robert Reichart
*
* Status : Accepted
* Runtime: 0.364
*/

import java.io.*;

class Main{
public static void main(String... args){
try{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line=in.readLine();
while(!line.equals("0")){
String linecopy=line;
int degree=0;
if (line.length()==1){degree=1;}
while(line.length()>1){
int x=0;
for (int i=0;i<line.length();i++){
x=x+Integer.parseInt(Character.toString(line.charAt(i)));
}
line=Integer.toString(x);
degree++;
}

if(line.equals("9")){
System.out.println(linecopy + " is a multiple of 9 and has 9-degree " + degree + ".");
}else{
System.out.println(linecopy + " is not a multiple of 9.");
}
line=in.readLine();
}
}catch(Exception ex){}

}
}