程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程解疑 >> character-Wiping Words

character-Wiping Words

編輯:編程解疑
Wiping Words

Description

In this problem, you are given a paragraph of text in terms of a sequence of lines. Each lines contains a number of words which are sequences of lowercase and uppercase letters and are separated by either blank characters or asterisks. A word is wiped out if for each character in that word, there is no letter or asterisk character in the same position in the next line, or the word appears in the last line of the input. If such a case happens, all occurrences of that word in the text is converted to blanks independent of the corresponding characters in the next line. Note that the asterisks and black characters never disappear. Also, note that the words are considered case-sensitive. Write a program to read a sequence of lines described above and wipe out as many word as it can iteratively.
Input

The first line of the input contains a single integer t (1 ≤ t ≤ 20) which is the number of test cases in the input. Each test case contains a sequence of lines containing characters A..Z, a..z, blank and asterisk (*). After each test case, there is a line containing single hash character (#) which is not a part of the lines you must consider in your algorithm.
Output

For each test case, write the input lines in the output with the wiped out words converted to blanks. Separate outputs for consecutive test cases with lines containing a single hash character.
Sample Input

2
ACM is
**
#
in this world
you are in*side
the world
*
#
Sample Output

ACM

**
#

you *

the

*
#

最佳回答:


http://www.bailian.openjudge.cn/practice/3905/statistics/

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved