//Written by Tanya Khovanova and Sergei Bernstein

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * WordsInAlphaOrderFinder takes lines of text on standard input and prints 
 * each line which characters are in non-decreasing
 * order of their ASCII code to standard output.
*/

public class WordsInAlphaOrderFinder{
  public static void main(String[] args) throws IOException {
    BufferedReader reader = new BufferedReader( new InputStreamReader(System.in));
    for(String dictWord = reader.readLine(); dictWord != null; dictWord = reader.readLine()) {
      if (alphaLetterOrder(dictWord))
	System.out.println(dictWord);
    }
  }

  public static boolean alphaLetterOrder(String word) {
    char currentChar = Character.MIN_VALUE;
    for (int i = 0; i < word.length(); i++) {
      if (word.charAt(i) >= currentChar) {
    	  currentChar = word.charAt(i);
      }
      else
	return false;
    }
    return true;
  }
}
