111qqz的小窝

老年咸鱼冲锋!

hihocoder 1197 Give My Text Back (模拟)

#1197 : Give My Text Back

时间限制:10000ms
单点时限:1000ms
内存限制:256MB

描述

To prepare for the English exam Little Ho collected many digital reading materials. Unfortunately the materials are messed up by a malware.

It is known that the original text contains only English letters (a-zA-Z), spaces, commas, periods and newlines, conforming to the following format:

1. Each sentence contains at least one word, begins with a letter and ends with a period.

2. In a sentence the only capitalized letter is the first letter.

3. In a sentence the words are separated by a single space or a comma and a space.

4. The sentences are separated by a single space or a single newline.

It is also known the malware changes the text in the following ways:

1. Changing the cases of letters.

2. Adding spaces between words and punctuations.

Given the messed text, can you help Little Ho restore the original text?

输入

A string containing no more than 8192 English letters (a-zA-Z), spaces, commas, periods and newlines which is the messed text.

输出

The original text.

样例输入
样例输出

比较容易忽视的几个细节是:
连续的空格或者换行符只能有一个;

一个句子是某一行最后一个句子的时候,’.’后没有空格

比较难处理的是,’.’或者’,’前面的空格.

我的做法是,先不处理,最后倒序处理.

 

说点什么

您将是第一位评论人!

提醒
wpDiscuz