注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
本帖最后由 woodman 于 2016-3-6 03:46 编辑
Problem Statement
You are given a list of clues, and all clues have the same length. Some of the letters are missing, and those letters are represented by question marks ('?'). Arrange the clues in a vertical row, such that corresponding characters in each clue are in the same column. Then, order the clues so that each column is sorted in non-decreasing order from top to bottom. You can replace each question mark with any letter to achieve this
Print the new list of clues containing the lexicographically earliest ordering that you can achieve. If there is no way to achieve the goal, print NONE instead. An ordering A comes before an ordering B if A contains an alphabetically earlier clue at the first index where they differ
Input
Line 1: N
Line 2 .. N + 1: clue_i
Output
As stated in the problem statement
Input Explanation
Line 1: N, the number of clues
Line 2 to line N+1: clue_i, uppercase A-Z characters
Output Explanation
Output will contain exactly N lines or NONE if no such ordering is possible
Sample Input
3
?ED?
TO??
????
Sample Output
AAAA
AEDA
TODA
如题 求个java 的解法 求大家指点 多谢了
import java.io.*;
import java.util.*;
class Test {
public static void main(String [] args) throws Exception{
BufferedReader in = new BufferedReader(
new InputStreamReader(System.in));
String str = in.readLine();
}
} |