import sys
import nltk
import codecs

c = raw_input('')
language = c[:4]

if language == "[RU]":
	stemmer = nltk.stem.snowball.RussianStemmer()
elif language == "[FR]":
	stemmer = nltk.stem.snowball.FrenchStemmer()
elif language == "[SP]":
	stemmer = nltk.stem.snowball.SpanishStemmer()
elif language == "[IT]":
	stemmer = nltk.stem.snowball.ItalianStemmer()
elif language == "[RO]":
	stemmer = nltk.stem.snowball.RomanianStemmer()
elif language == "[PT]":
	stemmer = nltk.stem.snowball.PortugueseStemmer()
elif language == "[GE]":
	stemmer = nltk.stem.snowball.GermanStemmer()
elif language == "[NL]":
	stemmer = nltk.stem.snowball.DutchStemmer()
elif language == "[SE]":
	stemmer = nltk.stem.snowball.SwedishStemmer()
elif language == "[NO]":
	stemmer = nltk.stem.snowball.NorwegianStemmer()
elif language == "[DK]":
	stemmer = nltk.stem.snowball.DanishStemmer()
elif language == "[FI]":
	stemmer = nltk.stem.snowball.FinnishStemmer()
elif language == "[AR]":
	stemmer = nltk.stem.isri.ISRIStemmer()


c = c[4:]

while True:
	if len(c) == 0:
		c = raw_input('')
		c = c[4:]
	
	print stemmer.stem(unicode(c.decode("unicode_escape"))).encode("unicode_escape")
	c = ""
	sys.stdout.flush()

