// Program 17: Words Containing the Last Shortest Word import java.util.*; class ShortestContained { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.nextLine().trim(); String[] words = s.split(" +"); String shortest = words[0]; for (String word : words) { if (word.length() <= shortest.length()) { shortest = word; } } System.out.println("Sentence: " + s); System.out.println("Last shortest word: " + shortest); for (String word : words) { if (word.indexOf(shortest) >= 0) { System.out.println(word); } } } }