#!/usr/bin/perl

use locale;

binmode(STDOUT, ":utf8");
binmode(STDIN, ":utf8");

while (defined($line = <STDIN>))
{
	next if ( ! $line ) ;

	$line =~ s/([\wâî]+)/\u\L$1/g;
	#$line =~ s/([\wâî]+)/[$1]/g;

	do {
		$ol = $line ;
		# for some weird and unknown reason lowercase(Ș) isn't computed
		$line =~ s/ (De|Din|Spre|La|Si|Pe|Și|Prin|Dinspre|Cu) / \l$1 /g;
	} until ( $ol =~ $line ) ;

	print $line ;

}

