Problem Statement
An acronym is a sequence of characters that is used to refer to something with a very long name. An acronym is generated from a long name by capitalizing the first letter of every word in the name and concatenating them together. There are three exceptions: the common words "and", "the", and "of" are ignored when generating the acronym. In this problem, a word is defined as one or more non-space characters preceded by either a space or the beginning of the string and followed by either a space or the end of the string. Write a class VLNString with a method makeAcronym that takes a
Definition
- Class:
- VLNString
- Method:
- makeAcronym
- Parameters:
- String
- Returns:
- String
- Method signature:
- String makeAcronym(String longName)
- (be sure your method is public)
Notes
- longName may contain leading and trailing spaces, and there may be more than one space between words.
- The return value may be an empty string.
Constraints
- longName will contain between 1 and 50 characters, inclusive.
- longName will contain only lowercase English letters ('a' to 'z') and space characters.
Examples
"dance dance revolution"
Returns: "DDR"
" return of the king "
Returns: "RK"
"the united states of america"
Returns: "USA"
" of the and "
Returns: ""
"s p a m"
Returns: "SPAM"
"something and"
Returns: "S"
"oneword"
Returns: "O"
"of"
Returns: ""
"the"
Returns: ""
"and"
Returns: ""
" "
Returns: ""
"blahof blahand blahthe"
Returns: "BBB"
"theblah ofblah andblah something"
Returns: "TOAS"
"word blandah blofah bltheah "
Returns: "WBBB"
"omgbighugegiganticwordthingyofginormousdestruction"
Returns: "O"
" fweebf f of rzvq andlbtmk zjlq yeoddhg "
Returns: "FFRAZY"
" jkppa and hijjp sljv of the of of "
Returns: "JHS"
" surqlzkpn the esboqpdgu dbzz qpkisc and os"
Returns: "SEDQO"
"and the and and sipivzq geadketova xddbjbm"
Returns: "SGX"
" rekuhjspbg of and xvgj z the and an"
Returns: "RXZA"
" w iizcgfj nhwnitcxsis hicammgfj ythe and and"
Returns: "WINHY"
" slsljk andof of ckvifiwo zcihcnskbg and "
Returns: "SACZ"
"rnikdltuo fsoqui sdbmexbfhbuoq iax szollfq"
Returns: "RFSIS"
"qefw jmo of eec glqxnyseo andezstlof the"
Returns: "QJEGA"
" ofpdgdodpdok bdp oehnqooc swuomeivdryko "
Returns: "OBOS"
" p the ad hyfxlddpxl the k lxkntauoi"
Returns: "PAHKL"
" and hdcfwqvqsw bluldkm urfmxtq vtssdwykkc "
Returns: "HBUV"
"uhnikqrpl c czepogygaerpgh vgrmleand ofrzxvkydcy"
Returns: "UCCVO"
"khvc frzzzxkuro q lxaxpugnsl the slpdafrx h"
Returns: "KFQLSH"
" kd zxcyjesypg rka bkwh nvlawkbdfo kmucex"
Returns: "KZRBNK"
"ktzayeesj and jkcffgra pqztp gmdhhozu m of "
Returns: "KJPGM"
" apdqbxat xq of rgr and naand the palvm"
Returns: "AXRNP"
" the yunfgdl rfxygsgdws the of hrovn xrgg"
Returns: "YRHX"
"andy and wcdzwof ufg ddmrpkkj ywmck "
Returns: "AWUDY"
" zkf of hivggp shdu dhastzpofdzegzkbag zmvh"
Returns: "ZHSDZ"
" mlxohespzjbioufkef mbt and ymtirjn xl "
Returns: "MMYX"
" x qzqjizsae and xlakquqpi of andqmo of"
Returns: "XQXA"
" rgnqffhbl cyabkw gdoz jfdzqpjspu of r "
Returns: "RCGJR"
" fkiomof cwsjand dlvtheqdoskgselv brj bfragezs"
Returns: "FCDBB"
" hdrbidiqn ydhpkciabmf the lzwlcbmw dbg"
Returns: "HYLD"
"sualzwnkjq and czrrh xgand f j mc t"
Returns: "SCXFJMT"
" fqnsdldqvkd and theof cdkzfpaaa niicfogc"
Returns: "FTCN"
" of kjfzxaof and the and xluofzvplx ay"
Returns: "KXA"
" o mart nujxrjesvjywpqentexwngv the and the"
Returns: "OMN"
" of trbubll sszxiryy mgbqvsgozaubfibnoj and "
Returns: "TSM"
" tiohszjz the the ankyrr and cfnxcvhaaof t"
Returns: "TACT"
" of sjgagjnkauthe ycxjsthxjbezdu wmlwplyayx "
Returns: "SYW"
" lwje wgfprtcxb of qjhjtxkup zydytbahi "
Returns: "LWQZ"
" and phmymcamuy mrzo wnjejydhpqedthe of k"
Returns: "PMWK"
" yttthe ceu xcith the thethe fxqjry hgi"
Returns: "YCXTFH"
" jc gvg and nhkarc vzx and the oe"
Returns: "JGNVO"
" return of the king "
Returns: "RK"
"andf kol"
Returns: "AK"
"this is a very simple expample"
Returns: "TIAVSE"
" h and the world "
Returns: "HW"
" return of the king "
Returns: "RK"
"anda"
Returns: "A"
"dance dance revolution"
Returns: "DDR"
"af rata of w"
Returns: "ARW"
"title animal orange hair and the texas"
Returns: "TAOHT"
"thes ands offs"
Returns: "TAO"