#!/usr/bin/perl

use strict;
use warnings;

my $lastLine;
my $endLine;
my $deb = 1;

while(<STDIN>){
	chomp($_);
	$_.=" ";
	if($lastLine){
		print $lastLine;
		$lastLine = "";
	}
	if($_ !~ /^\s*$/){
		my $line = $_;
		if($deb){
			$line = "<s> ".$line;
			$deb = 0;
		}
		$line =~ s/\.\s*/ <\/s>\n<s> /g;
		$line =~ s/( <\/s>)+/ <\/s>/g;
		$line =~ s/\n+/\n/g;
		$line =~ s/ +/ /g;
		$lastLine = $line;
		$endLine = $lastLine;
	}
}

if($endLine){
	if($endLine =~ /\n<s> $/){
		$endLine =~ s/\n<s> $//g
	}
	else{
		$endLine =~ s/$/ <\/s>/g
	}
	$endLine =~ s/ +/ /g;
	$endLine =~ s/$/\n/g;
	print $endLine;
}

