import java.util.Scanner; import java.io.*; class Node { String s ; Node next; Node(String s) { this.s = s; } } class DictSplit { int start; String str; DictSplit(String s) { this.str = s; start = 0; } public String next() { if (start >= str.length()) { return null; } int i = start; String ans = null; int wc = 0; while (i < str.length()) { char ch = str.charAt(i); if (ch >= 'A' && ch <= 'Z' || ch >= 'a' && ch <= 'z') { wc++; } else { if (wc > 0) { ans = str.substring(start, start + wc); start += wc; break; } else { start++; } } i++; } if (ans == null && start < str.length()) { ans = str.substring(start); start = str.length(); } return ans; } } // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); DictSplit ds = new DictSplit(br.readLine()); br.close(); String word = null; Node dummy = new Node(null); while ((word = ds.next()) != null) { Node t = new Node(word); t.next = dummy.next; dummy.next = t; } Node cursor = dummy.next; while (cursor != null) { System.out.print(cursor.s + " "); cursor = cursor.next; } System.out.println(); } }