//  author:  Peter Greiner
//  mat#:    0101750
//  email:   e0101750@student.tuwien.ac.at
//  date:    11-17-2001
//  bsp.no.  1128
//  job:     Abteilen von Woertern
  


import eprog.EprogIO;
import java.util.StringTokenizer;

public class abteil extends EprogIO {

  private static final String   ERR_MSG      = "FALSCHE EINGABE";

  private static final char[]   UMLAUT       = {'ä', 'Ä', 'ö', 'Ö', 'ü', 'Ü'};
  private static final int      UMLAUT_AMT   = 6;
  
  private static final String[] SYLLABLE     = {"keit", "heit", "los", "sam", "schaft", "Keit", "Heit", "Los", "Sam", "Schaft"};
  private static final int      SYLLABLE_AMT = 10;
  
  private static final String   HYPHEN       = "-";
  private static final char     CHYPH        = HYPHEN.charAt(0);
  

  private abteil() {
  }
  
  public static void main(String args[]) {

    String   lineInput  = "";
    String   lineOutput = "";
    abteil   _abteil    = new abteil();
    String[] words      = null;

    try {

      lineInput = readWord();

      words = _abteil.checkInput(lineInput);
   
      lineOutput = _abteil.formatInput(words);

      println(lineOutput);

	} catch(Exception e) {

      println(ERR_MSG);
	}
  }
  
  private String[] checkInput(String inputStr)
    throws Exception {
  
    boolean         checked      = false;
    StringTokenizer st           = new StringTokenizer(inputStr, ",", true);
    String          hlp          = "";
    String[]        hlpAry       = {"", "", "", "", "", ""};
    int             cnt          = 0;
    int             cntWordComma = 0;

    //mehr als 6 wörter incl. beistrich liefert Exception.
    if (st.countTokens() > 6) {

      throw new Exception();
    }
     
    while (st.hasMoreTokens()) {
     
      hlp = st.nextToken();

      if ( hlp.compareTo(",") != 0 ) { // hlp ist Wort
      
        cntWordComma--;
        
        checked = isWord(hlp);

        if (checked == false) {
		  
          throw new Exception();
        } 
	  } else {                          // hlp ist Beistrich

        cntWordComma++;
      }
      
      hlpAry[cnt] = hlp;
      
      cnt++;
    }

    if ((cntWordComma != 0) && (cntWordComma != -1)) {    // Schauen, ob mehr Beistriche als Anzahl Wörter +1
    
      throw new Exception();
    }
    
    return hlpAry;
  }

  private String formatInput(String[] inputAry) {

    String outputStr = "";
    String word      = "";
    int    i         = 0;
    int    len       = inputAry.length; 
    
    for  (i = 0; i < len; i++) {
    
      if (inputAry[i].compareTo(",") == 0) { // words[i] ist ein Beistrich
      
        outputStr += inputAry[i];
      } else {
      
        word = wordDivision(inputAry[i]);
      
        outputStr += word;
      }
    }

    return outputStr;
  }

  private String eraseHyph(String toClean) {
  
    int    wordlen = toClean.length();
    int    i       = 0;

    toClean += " ";

    for (i = 0; i < wordlen; i++) {

      while ( ( toClean.charAt(i) == CHYPH ) && ( toClean.charAt(i + 1) == CHYPH ) ) {
      
        toClean = (toClean.substring(0, i) + toClean.substring(i + 1));
        
        wordlen = toClean.length();
      }	
    }
    
    wordlen = toClean.length();
    
    toClean = toClean.substring(0, --wordlen);
    
    
    if (toClean.endsWith(HYPHEN)) {

      wordlen = toClean.length();
    
      toClean = toClean.substring(0, wordlen - 1);
    }
   
    if (toClean.startsWith(HYPHEN)) {
   
      toClean = toClean.substring(1);
    }

    return toClean;
  }

  private String singled(String singled) {
  
    int  len     = singled.length();
    char prelast = 0;
    char single  = 0;
    
    if (len > 2) {
    
      do {
    
        prelast = singled.charAt(len - 2);
      
        single = singled.charAt(len -1);
      
        if (prelast == CHYPH) {
      
          singled = (singled.substring(0, len - 2) + single);
          
          len--;
        }
      } while (prelast == CHYPH);
    }
    
    return singled;
  }

  private String wordDivision(String toDivide) {
    
    String divided  = toDivide;
    int    i        = 0;
    int    j        = 0;
    int    position = 0;
    int    endsyl   = 0;
    char   last     = 0;
    int    wordlen  = toDivide.length();

    for (i = 0; i < SYLLABLE_AMT; i++) {
      
      for (j = 0; j < wordlen; j++) {
      
        position = toDivide.indexOf(SYLLABLE[i], (j));

        endsyl = position + SYLLABLE[i].length() ;
      
        if (position > -1) {
        
          divided = (toDivide.substring(0, position) + HYPHEN + SYLLABLE[i] + HYPHEN + toDivide.substring(endsyl));
          
          wordlen += 2;
          
          j += (SYLLABLE[i].length() + 1);

          toDivide = divided;
        }
        
        toDivide = divided;
      }
    } 

    divided = eraseHyph(divided);
    
    divided = singled(divided);
    
    return divided;
  }
    
  private boolean isWord(String word) {
  
    boolean checked  = true;
    boolean isLetter = false;
    boolean umlaut   = true;
    char[]  chAry    = null;
    int     len      = word.length();
    int     i        = 0;

    if (len > 20) {
      
      return false;
    }

    chAry = word.toCharArray();
    
    for (i = 0; i < len; i++) {

      isLetter = Character.isLetter(chAry[i]);
      
      umlaut   = isUmlaut(chAry[i]);
      
      if ((isLetter == false) || (umlaut == true)) {
      
        return false;
      }
    }

    return checked;  
  }

  private boolean isUmlaut(char ch) {

    boolean umlaut = false;
    int     i      = 0;
    
    for (i = 0; i < UMLAUT_AMT; i++) {
    
      if (ch == UMLAUT[i]) {
      
        return true;
      }  
    }
    
    return umlaut;
  }
}