Statistics

Problem Statement for "VLNString"

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 String longName and returns a String with its acronym generated as described above.

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

  1. "dance dance revolution"

    Returns: "DDR"

  2. " return of the king "

    Returns: "RK"

  3. "the united states of america"

    Returns: "USA"

  4. " of the and "

    Returns: ""

  5. "s p a m"

    Returns: "SPAM"

  6. "something and"

    Returns: "S"

  7. "oneword"

    Returns: "O"

  8. "of"

    Returns: ""

  9. "the"

    Returns: ""

  10. "and"

    Returns: ""

  11. " "

    Returns: ""

  12. "blahof blahand blahthe"

    Returns: "BBB"

  13. "theblah ofblah andblah something"

    Returns: "TOAS"

  14. "word blandah blofah bltheah "

    Returns: "WBBB"

  15. "omgbighugegiganticwordthingyofginormousdestruction"

    Returns: "O"

  16. " fweebf f of rzvq andlbtmk zjlq yeoddhg "

    Returns: "FFRAZY"

  17. " jkppa and hijjp sljv of the of of "

    Returns: "JHS"

  18. " surqlzkpn the esboqpdgu dbzz qpkisc and os"

    Returns: "SEDQO"

  19. "and the and and sipivzq geadketova xddbjbm"

    Returns: "SGX"

  20. " rekuhjspbg of and xvgj z the and an"

    Returns: "RXZA"

  21. " w iizcgfj nhwnitcxsis hicammgfj ythe and and"

    Returns: "WINHY"

  22. " slsljk andof of ckvifiwo zcihcnskbg and "

    Returns: "SACZ"

  23. "rnikdltuo fsoqui sdbmexbfhbuoq iax szollfq"

    Returns: "RFSIS"

  24. "qefw jmo of eec glqxnyseo andezstlof the"

    Returns: "QJEGA"

  25. " ofpdgdodpdok bdp oehnqooc swuomeivdryko "

    Returns: "OBOS"

  26. " p the ad hyfxlddpxl the k lxkntauoi"

    Returns: "PAHKL"

  27. " and hdcfwqvqsw bluldkm urfmxtq vtssdwykkc "

    Returns: "HBUV"

  28. "uhnikqrpl c czepogygaerpgh vgrmleand ofrzxvkydcy"

    Returns: "UCCVO"

  29. "khvc frzzzxkuro q lxaxpugnsl the slpdafrx h"

    Returns: "KFQLSH"

  30. " kd zxcyjesypg rka bkwh nvlawkbdfo kmucex"

    Returns: "KZRBNK"

  31. "ktzayeesj and jkcffgra pqztp gmdhhozu m of "

    Returns: "KJPGM"

  32. " apdqbxat xq of rgr and naand the palvm"

    Returns: "AXRNP"

  33. " the yunfgdl rfxygsgdws the of hrovn xrgg"

    Returns: "YRHX"

  34. "andy and wcdzwof ufg ddmrpkkj ywmck "

    Returns: "AWUDY"

  35. " zkf of hivggp shdu dhastzpofdzegzkbag zmvh"

    Returns: "ZHSDZ"

  36. " mlxohespzjbioufkef mbt and ymtirjn xl "

    Returns: "MMYX"

  37. " x qzqjizsae and xlakquqpi of andqmo of"

    Returns: "XQXA"

  38. " rgnqffhbl cyabkw gdoz jfdzqpjspu of r "

    Returns: "RCGJR"

  39. " fkiomof cwsjand dlvtheqdoskgselv brj bfragezs"

    Returns: "FCDBB"

  40. " hdrbidiqn ydhpkciabmf the lzwlcbmw dbg"

    Returns: "HYLD"

  41. "sualzwnkjq and czrrh xgand f j mc t"

    Returns: "SCXFJMT"

  42. " fqnsdldqvkd and theof cdkzfpaaa niicfogc"

    Returns: "FTCN"

  43. " of kjfzxaof and the and xluofzvplx ay"

    Returns: "KXA"

  44. " o mart nujxrjesvjywpqentexwngv the and the"

    Returns: "OMN"

  45. " of trbubll sszxiryy mgbqvsgozaubfibnoj and "

    Returns: "TSM"

  46. " tiohszjz the the ankyrr and cfnxcvhaaof t"

    Returns: "TACT"

  47. " of sjgagjnkauthe ycxjsthxjbezdu wmlwplyayx "

    Returns: "SYW"

  48. " lwje wgfprtcxb of qjhjtxkup zydytbahi "

    Returns: "LWQZ"

  49. " and phmymcamuy mrzo wnjejydhpqedthe of k"

    Returns: "PMWK"

  50. " yttthe ceu xcith the thethe fxqjry hgi"

    Returns: "YCXTFH"

  51. " jc gvg and nhkarc vzx and the oe"

    Returns: "JGNVO"

  52. " return of the king "

    Returns: "RK"

  53. "andf kol"

    Returns: "AK"

  54. "this is a very simple expample"

    Returns: "TIAVSE"

  55. " h and the world "

    Returns: "HW"

  56. " return of the king "

    Returns: "RK"

  57. "anda"

    Returns: "A"

  58. "dance dance revolution"

    Returns: "DDR"

  59. "af rata of w"

    Returns: "ARW"

  60. "title animal orange hair and the texas"

    Returns: "TAOHT"

  61. "thes ands offs"

    Returns: "TAO"


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: