Problem Statement
Strange abbreviations are often used to write text messages on uncomfortable mobile devices. One particular strategy for encoding texts composed of alphabetic characters and spaces is the following:
- Spaces are maintained, and each word is encoded individually. A word is a consecutive string of alphabetic characters.
- If the word is composed only of vowels, it is written exactly as in the original message.
- If the word has at least one consonant, write only the consonants that do not have another consonant immediately before them. Do not write any vowels.
- The letters considered vowels in these rules are 'a', 'e', 'i', 'o' and 'u'. All other letters are considered consonants.
You will be given the original message in the
Definition
- Class:
- TxMsg
- Method:
- getMessage
- Parameters:
- String
- Returns:
- String
- Method signature:
- String getMessage(String original)
- (be sure your method is public)
Constraints
- original will contain between 1 and 50 characters, inclusive.
- Each character of original will be a lowercase letter ('a'-'z'), or a space.
- There will not be two consecutive spaces in original, nor will the first or last character be a space.
Examples
"text message"
Returns: "tx msg"
"ps i love u"
Returns: "p i lv u"
First example from the problem statement.
"please please me"
Returns: "ps ps m"
Second example from the problem statement.
"back to the ussr"
Returns: "bc t t s"
"aeiou bcdfghjklmnpqrstvwxyz"
Returns: "aeiou b"
"nsemfeyzasv sufnoogbia cpevavuhja doolosofap"
Returns: "nmys sfg cvvh dlsfp"
"ilacaoyudia utjuviogofr wnoisduzelq oiwtasuewl"
Returns: "lcyd tvgf wszl wsw"
"iovhiduypoi oewuofeisl esyiasezae gyaiwozqup"
Returns: "vdy wfs ssz gwzp"
"iqdikixeex urzofegsutc ejmijhoife iovehoihox"
Returns: "qkxx rfgt jjf vhhx"
"jgouwborau lojaveuyodm inxuemguqd kutuaglexb"
Returns: "jwr ljvyd nmq ktgx"
"uelroibugoe qjodzoqeong iutarkogdaa eoziwhueyou"
Returns: "lbg qdqn trg zwy"
"mmuwiyriars ovvoceneqa icjeiqloeyd zoiswocbei"
Returns: "mwyr vcnq cqy zsc"
"loehufipnao ojoezaomsu ewahuxdequ nuoyeadoey"
Returns: "lhfp jzm whxq nydy"
"imuitoiwea oehehiqruwg ujuqxemuku zrutuyiulo"
Returns: "mtw hhqw jqmk ztyl"
"oxizburoih iezuxaolabx ghigotvicr talalgeodua"
Returns: "xzrh zxlb ggtc tlld"
"iudasliiyd jsotxuvarv aegoclisux giqecoktat"
Returns: "dsy jtvr gcsx gqckt"
"gsicziutqaa aramiagire ueggokjiuxc aurewaniesm"
Returns: "gct rmgr gkx rwns"
"opasfobtuo neuxuetasuu smudiiveix pueruozipe"
Returns: "psb nxts sdvx przp"
"luizvokileu eqewtaihoe juoskutevl xamxobyemy"
Returns: "lzkl qwh jstv xmbm"
"aarnoniacu vaakxaeyjaa hjoszuaraa iushaziladn"
Returns: "rnc vky hsr szld"
"uhpegeetea xafisirool ifuxuuwdua obuwumiatn"
Returns: "hgt xfsrl fxw bwmt"
"fuxcoqiunw dveqozowaa cepemapooxw eypuljifek"
Returns: "fxqn dqzw cpmpx ylfk"
"lozutuyumeo ialeegxokm rouykeutotz mefniorcun"
Returns: "lztym lgk rytt mfrn"
"neixajdifeu hgoufeweixp cuayriuzne ivibiqzedeo"
Returns: "nxjf hfwx cyz vbqd"
"ajiavqeflue koeleelnucx iodenouyua ojsicoumzo"
Returns: "jvf kllc dny jcm"
"gveraetaayh ofacigoabue qiekfebvesp lifaveirix"
Returns: "grty fcgb qkbs lfvrx"
"aawpopujoo yieruibuizf zzukluipalp bdoififracr"
Returns: "wpj yrbz zkpl bffc"
"gjeamodeha jegadcewoo toikuzobomd odanroslihk"
Returns: "gmdh jgdw tkzbm dnsh"
"amdohitucai eazefayutou voqcouyaxd zhagacozax"
Returns: "mhtc zfyt vqyx zgczx"
"geodiubtou oesuicioda ualiupheaqs uepeteqott"
Returns: "gdb scd lpq ptqt"
"ofisroucmo qciawraado nbusireykao oabihildir"
Returns: "fsc qwd nsry bhlr"
"eorokhicedv qolaebiaca laoyikoacea jednelzoef"
Returns: "rkcd qlbc lykc jdlf"
"uzookibize xioturdoup eaweuloruq iujeirdotii"
Returns: "zkbz xtrp wlrq jrt"
"oujguefrij enfoahijfo pbailorokio yoatnurieq"
Returns: "jfj nhj plrk ytrq"
"kyoruhiovw oojaiximinf huvegmuqzi wiunakilqi"
Returns: "krhv jxmn hvgq wnkl"
"yuxiocleord aelalgauyo ceiqusweka dkommainjo"
Returns: "yxcr lly cqsk dmn"
"uceuguvenoa cseibeawso adeloajnuzt eohzofrito"
Returns: "cgvn cbw dljz hft"
"oofemifipu zsouzauticv oeqokcanvo exoulsebui"
Returns: "fmfp zztc qkn xlb"
"iqdeumpaxu ituujnuvwi pocjoposed emfuonaixu"
Returns: "qmx tjv pcpsd mnx"
"ucasetiqei adiduwpeqj pekkobneesm julmuebtagq"
Returns: "cstq ddwq pkbs jlbg"
"uguoztaowie mkuivalhai oreuqociiw kizigbihaw"
Returns: "gzw mvl rqcw kzghw"
"hjeoyuaqak jiqeajerue lommiotiosl iarwikuayie"
Returns: "hyqk jqjr lmts rky"
"iigxuosani aivbiolaad oiyuibpixa ynemgednio"
Returns: "gsn vld ybx ymd"
"reuhzouyor knuqsinirie naqouhtuxeo oyihovcoit"
Returns: "rhyr kqnr nqhx yhvt"
"ibhonizfoe zquxaivfek wefuawumuz ufiecehyec"
Returns: "bnz zxvk wfwmz fchc"
"ibomsuizel ihboizciid eviorekzee ovidcocafeo"
Returns: "bmzl hzd vrk vdcf"
"axsemcubbo obifuafaln eyuavuirtio voryaheoju"
Returns: "xmb bffl yvr vrhj"
"pihehavekg eojdolvuyui cuocdoojeo eesehaogsea"
Returns: "phhvk jly ccj shg"
"yateovfiap wajxiavoca vaviiyeuvee akeluiboer"
Returns: "ytvp wjvc vvyv klbr"
"erauwroojj tukepedloo ereotaciyk roqaqeoqnei"
Returns: "rwj tkpd rtcy rqqq"
"whaaviluww cuexiapuhb efmendiwebl oegebofaig"
Returns: "wvlw cxph fnwb gbfg"
"awveqejagy vveidseelb toipibzoifg qsioboohliu"
Returns: "wqjg vdl tpbf qbh"
"uoteejihri deqwuwavse easouqaagai psuaqyuuqoa"
Returns: "tjh dqwv sqg pqq"
"iznipuuquc etoelzetic vimwutukjao gwahamzosia"
Returns: "zpqc tltc vmtk ghms"
"ifeejeirav exucaiyuons sbedtejmew ogboatemyeo"
Returns: "fjrv xcyn sdjw gtm"
"oexoyeadte toeyavvimv maaxezuiqo lzubuadovj"
Returns: "xyd tyvm mxzq lbdv"
"ufnoowubabv zojaugujho udizdogotq usuewejeuyt"
Returns: "fwbb zjgj dzgt swjy"
"iymuugwejii pazquuziop acapetihtu kzacuinrinh"
Returns: "ygj pzzp cpth kcnn"
"iaauaeuueeaoeauaeuoaioaueouuiaeaueouiiieeoaaoiueoi"
Returns: "iaauaeuueeaoeauaeuoaioaueouuiaeaueouiiieeoaaoiueoi"
"zvwmccbyrflsffzlnqqz iaaaiaeaiieiaaaaouia"
Returns: "z iaaaiaeaiieiaaaaouia"
"iaioiuieuoqcymqpyrljuaeieiaaeihtltnrylrteuueeaoeau"
Returns: "qh"
"aeuoaioauepbywhpkmztiaeaueouiibhppmlrtqzmfpkjdnzqp"
Returns: "pb"
"oaaoiueoiovcytkzhdylueeiaaaiaeaiieiaaaaoysqhdvjgvn"
Returns: "vy"
"uiaoieiuaalnqqzkcqhbldsmblbtmwoeeuaiuoiopzqhjsjtrh"
Returns: "lp"
"ueiaeoaueuztfynftdwqxmddbywfpmuoauauueuuoiooaeouia"
Returns: "z"
"ooooiuooieoauiiiueaatcryjfkzdfaoioeaeouobdmshczzxv"
Returns: "tb"
"eieioaeeeaioeoaiouoiwrczchskgcoouooeiieeueuiueeoae"
Returns: "w"
"jjkvvmzxjgoeeoaaoiuaiaeeaioiiegwxnnmvfmseoiieoeuuo"
Returns: "jg"
"fcpgsjngfbuuuioioeiiieuuuuuioofryqncmhnzghhpbcgpjx"
Returns: "ff"
"ntldzxrqrwtjlgktqbfhaoiouoouooltxpzmbllcuueuieeeoe"
Returns: "nl"
"ndngwmntblzsggtnqmhxoieoaaaueubbzhbqtvlfqykvpnrmfs"
Returns: "nb"
"tywhjqksrjbbwwhnnftdueiioieiiooaiaueuauorrndqtmmzz"
Returns: "tr"
"a"
Returns: "a"
"x"
Returns: "x"
"a b c d e f g h i j k l m n o p q r s t u v w x"
Returns: "a b c d e f g h i j k l m n o p q r s t u v w x"
"aaa oib uce cai hlo nim axy vtx y z ef go gt uu"
Returns: "aaa b c c h nm x v y z f g g uu"
"ooooo"
Returns: "ooooo"
"m m m m m m e m mm mm mm eeem eee mm"
Returns: "m m m m m m e m m m m m eee m"
"abd zzz iiio iide ozahaok"
Returns: "b z iiio d zhk"
"aiueo wowow ononono ghjk"
Returns: "aiueo www nnn g"
"ae"
Returns: "ae"
"aaa"
Returns: "aaa"
"yydd yyy jjjff jjj jj"
Returns: "y y j j j"
"iii rrr rirrriii ashhytt"
Returns: "iii r rr s"
"eyuioa"
Returns: "y"
"ps i love u aeiueo abfefbdkbfoiuiuochjjioihi"
Returns: "p i lv u aeiueo bfch"
"albbc acc lba oto yyy cnmlgb"
Returns: "l c l t y c"
"aaaa eee iii"
Returns: "aaaa eee iii"
"eeiou eee rtio"
Returns: "eeiou eee r"
"asdfssdf eaiaeia aifj jfsdkeia aia aiiai hjh jhhqq"
Returns: "s eaiaeia f j aia aiiai h j"
"ououssssssssssssssssssss qeqtygdzs"
Returns: "s qq"
"ttttt aaya"
Returns: "t y"
"a t"
Returns: "a t"
"ai iu ue eoiua aiusaeo stu sui sot a i u e o x"
Returns: "ai iu ue eoiua s s s st a i u e o x"
"aeiou"
Returns: "aeiou"
"za"
Returns: "z"
"a e i paer pae you uy"
Returns: "a e i pr p y y"
"aeappeeap"
Returns: "pp"
"ai p"
Returns: "ai p"
"aaaaeeee aaaaeeee"
Returns: "aaaaeeee aaaaeeee"
"akgh ijsd"
Returns: "k j"