Statistics

Problem Statement for "SentenceCapitalizerInator"

Problem Statement

You are given a simple paragraph containing a number of sentences, the original person who wrote the paragraph was in a rush and used only lower case letters ('a'-'z') for the words in the paragraph and did not use any punctuation other than a period to separate sentences. Your task is to fix the capitalization in the paragraph, the objective is to make it so every sentence in the paragraph begins with a capital (upper case) letter ('A'-'Z').

The paragraph is formatted as one or more sentences separated by single space (' ') characters. Each sentence consists of one or more words separated by single space (' ') characters. The last word in a sentence is always immediately followed by a single dot ('.') character. Each word is a non-empty string containing only lower case letters ('a'-'z'). As an example, consider the following paragraph (quotes for clarity):

"this is merely an example. be careful. this is a new sentence."

The result of your program must then be as follows:

"This is merely an example. Be careful. This is a new sentence."

Definition

Class:
SentenceCapitalizerInator
Method:
fixCaps
Parameters:
String
Returns:
String
Method signature:
String fixCaps(String paragraph)
(be sure your method is public)

Constraints

  • paragraph will contain between 2 and 50 characters, inclusive.
  • Each character in paragraph will be a lower case letter ('a'-'z'), a space (' ') or a dot ('.').
  • The first character of paragraph will be a lower case letter ('a'-'z').
  • The last character of paragraph will be a dot ('.').
  • There will be no two consecutive space characters in paragraph.
  • Every space (' ') character in paragraph will precede a letter.
  • Every '.' character in paragraph except the last one will precede a space character.

Examples

  1. "hello programmer. welcome to topcoder."

    Returns: "Hello programmer. Welcome to topcoder."

  2. "one."

    Returns: "One."

    A sentence can consist of just a single word.

  3. "not really. english. qwertyuio. a. xyz."

    Returns: "Not really. English. Qwertyuio. A. Xyz."

  4. "example four. the long fourth example. a. b. c. d."

    Returns: "Example four. The long fourth example. A. B. C. D."

  5. "contractual."

    Returns: "Contractual."

  6. "suffixing saurus to peoples names is not nice."

    Returns: "Suffixing saurus to peoples names is not nice."

  7. "q."

    Returns: "Q."

  8. "a b c d e f g h i j k l m n o p q r s t u v w x y."

    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 y."

  9. "a. b. c. d. e. f. g. h. i. j. k. l. m. n. o. p. q."

    Returns: "A. B. C. D. E. F. G. H. I. J. K. L. M. N. O. P. Q."

  10. "a. a."

    Returns: "A. A."

  11. "y."

    Returns: "Y."

  12. "c. j tl g. maj. k. o v. q. l w. so i. tt."

    Returns: "C. J tl g. Maj. K. O v. Q. L w. So i. Tt."

  13. "nd. h i. yz n. a. g. s."

    Returns: "Nd. H i. Yz n. A. G. S."

  14. "v. q. z."

    Returns: "V. Q. Z."

  15. "c. le. s. l. ld x w. hxod. b. u. dda. n q eu."

    Returns: "C. Le. S. L. Ld x w. Hxod. B. U. Dda. N q eu."

  16. "gr. f. ql ff c. g. g. o. a. zj. bd. a b c. yi."

    Returns: "Gr. F. Ql ff c. G. G. O. A. Zj. Bd. A b c. Yi."

  17. "f q."

    Returns: "F q."

  18. "e. s. a. t. x. k. z."

    Returns: "E. S. A. T. X. K. Z."

  19. "xkw zupvdiycgzqqfvpxxe."

    Returns: "Xkw zupvdiycgzqqfvpxxe."

  20. "eyzuzrapj."

    Returns: "Eyzuzrapj."

  21. "e. s. a. t. x. k. z."

    Returns: "E. S. A. T. X. K. Z."

  22. "kwd. no. a wo. y. v. s. a b. n."

    Returns: "Kwd. No. A wo. Y. V. S. A b. N."

  23. "dxg b. ct t. z. zv. swl. t ncj. n. t. tra. zu."

    Returns: "Dxg b. Ct t. Z. Zv. Swl. T ncj. N. T. Tra. Zu."

  24. "ln. y ij e."

    Returns: "Ln. Y ij e."

  25. "i."

    Returns: "I."

  26. "gmt vjm. i. x."

    Returns: "Gmt vjm. I. X."

  27. "o. o. h h n."

    Returns: "O. O. H h n."

  28. "h. e. h y. sp. l. z. o. t i. vr. f. o u nz."

    Returns: "H. E. H y. Sp. L. Z. O. T i. Vr. F. O u nz."

  29. "az sym golqm pich. i bqh tester."

    Returns: "Az sym golqm pich. I bqh tester."

  30. "o. y. t. p avac. m. suo."

    Returns: "O. Y. T. P avac. M. Suo."

  31. "t. n. pu. usk v. a. hd. s. th z."

    Returns: "T. N. Pu. Usk v. A. Hd. S. Th z."

  32. "z c. tbr ja. ukl."

    Returns: "Z c. Tbr ja. Ukl."

  33. "pkhckevwcjcsvgljuvbyjnsknnvlsvqcdetilahinkjiqoe."

    Returns: "Pkhckevwcjcsvgljuvbyjnsknnvlsvqcdetilahinkjiqoe."

  34. "bpaycygqoypogvutfdrjugeatlegutnlntvennlipmkazpb."

    Returns: "Bpaycygqoypogvutfdrjugeatlegutnlntvennlipmkazpb."

  35. "bytajmxzzguztustvidgxirixkiivchcnxmxsyqcnqtyya."

    Returns: "Bytajmxzzguztustvidgxirixkiivchcnxmxsyqcnqtyya."

  36. "uudffaczwwsnilbawhzusiowftkyuzsultjsvqqodrfcpy."

    Returns: "Uudffaczwwsnilbawhzusiowftkyuzsultjsvqqodrfcpy."

  37. "sbhaarnvszqcorppkssoawjmokovhkvuzjwfkfwrvrhlfx."

    Returns: "Sbhaarnvszqcorppkssoawjmokovhkvuzjwfkfwrvrhlfx."

  38. "never forget srm five hundred and four."

    Returns: "Never forget srm five hundred and four."

  39. "pvndiwhyuswwcwmjlryeyivnwkkogzzmmqsmkgpzzy. b."

    Returns: "Pvndiwhyuswwcwmjlryeyivnwkkogzzmmqsmkgpzzy. B."

  40. "xldupufluyjpmpdbgdglachxdrtrfvewyhyvoricrtnvj."

    Returns: "Xldupufluyjpmpdbgdglachxdrtrfvewyhyvoricrtnvj."

  41. "kynxvgmsrumoiooejtdurdsbqkilvymfwtc. eqfznyt. mvr."

    Returns: "Kynxvgmsrumoiooejtdurdsbqkilvymfwtc. Eqfznyt. Mvr."

  42. "zorpdwvpfwenkmvtyjekzruyrzhfvosqsrheiskvsuioo."

    Returns: "Zorpdwvpfwenkmvtyjekzruyrzhfvosqsrheiskvsuioo."

  43. "utp. reurvhuo. fvhma. msw. cep. rbpf. xpzlisd."

    Returns: "Utp. Reurvhuo. Fvhma. Msw. Cep. Rbpf. Xpzlisd."

  44. "h. hvjrpq. ny. cquwuyeic. dplzdnvhlyvbssgmcxm."

    Returns: "H. Hvjrpq. Ny. Cquwuyeic. Dplzdnvhlyvbssgmcxm."

  45. "tbywqswolicpmybgx. cwjixoopo. sdtftavyonhysgxxbq."

    Returns: "Tbywqswolicpmybgx. Cwjixoopo. Sdtftavyonhysgxxbq."

  46. "efffaqtfdgvqvc. oen. yt. knr. ggoasat c. ldwn. hq."

    Returns: "Efffaqtfdgvqvc. Oen. Yt. Knr. Ggoasat c. Ldwn. Hq."

  47. "no. jevzdvb. dlkztdidbk. prsm s. ulygxn. wntk."

    Returns: "No. Jevzdvb. Dlkztdidbk. Prsm s. Ulygxn. Wntk."

  48. "movd. lfqzgnkeblpvryauib. ceojwouvhhetvlj. en."

    Returns: "Movd. Lfqzgnkeblpvryauib. Ceojwouvhhetvlj. En."

  49. "j. yao. q. zy hy. nszt nydu. xjslmtstilygp. p."

    Returns: "J. Yao. Q. Zy hy. Nszt nydu. Xjslmtstilygp. P."

  50. "hphz. ymihcf. vpnloxz. olirjerqrqwapjjssnqakezxk."

    Returns: "Hphz. Ymihcf. Vpnloxz. Olirjerqrqwapjjssnqakezxk."

  51. "urdpqkxtwj. xqqzxg. vhyveom. hudgkbvrk rfitph."

    Returns: "Urdpqkxtwj. Xqqzxg. Vhyveom. Hudgkbvrk rfitph."

  52. "gedbsygwaohhbanoaenksomhrzz. xuoizrtgwbnbr. cmkp."

    Returns: "Gedbsygwaohhbanoaenksomhrzz. Xuoizrtgwbnbr. Cmkp."

  53. "v pj g w c i ix g f v j k x n x t r c j bq whc."

    Returns: "V pj g w c i ix g f v j k x n x t r c j bq whc."

  54. "v h lg ca z a e v uq px bq fq k i f p u v m x oh."

    Returns: "V h lg ca z a e v uq px bq fq k i f p u v m x oh."

  55. "n l w j i i i l dc og h p s sc n z y s r v u l t."

    Returns: "N l w j i i i l dc og h p s sc n z y s r v u l t."

  56. "f c r s e x c b z s k d d g l a t jg j b g b v."

    Returns: "F c r s e x c b z s k d d g l a t jg j b g b v."

  57. "k s xz e c p he t i a t i m i h x b g pq pu d."

    Returns: "K s xz e c p he t i a t i m i h x b g pq pu d."

  58. "k t. q h y. e. q s r t m. l u. s. i y o d g."

    Returns: "K t. Q h y. E. Q s r t m. L u. S. I y o d g."

  59. "q y. j. s p. c m p k. e. r o jd x z. q m."

    Returns: "Q y. J. S p. C m p k. E. R o jd x z. Q m."

  60. "k a. t. j c n x c. j. a z. c. h. f t v ds."

    Returns: "K a. T. J c n x c. J. A z. C. H. F t v ds."

  61. "q o. g h. u. e j. v. l. b. h. o jj v. b."

    Returns: "Q o. G h. U. E j. V. L. B. H. O jj v. B."

  62. "t. v. w a w. a. g t c d. n a e. w e. r m n."

    Returns: "T. V. W a w. A. G t c d. N a e. W e. R m n."

  63. "f."

    Returns: "F."

  64. "t. r s."

    Returns: "T. R s."

  65. "s."

    Returns: "S."

  66. "z."

    Returns: "Z."

  67. "b. g."

    Returns: "B. G."

  68. "c fqcsbmb qx. tlu txvnlk fil twtdimi."

    Returns: "C fqcsbmb qx. Tlu txvnlk fil twtdimi."

  69. "waiuezxubwfdqmt. hbrgxgmaryy."

    Returns: "Waiuezxubwfdqmt. Hbrgxgmaryy."

  70. "ube. jfaemcahovqz dntq. kznux."

    Returns: "Ube. Jfaemcahovqz dntq. Kznux."

  71. "emi. l kr xavrjkcssgngrw mjwbwhco."

    Returns: "Emi. L kr xavrjkcssgngrw mjwbwhco."

  72. "e zsoqhibqgept mie egiyyp mdv. k alndtoi xd."

    Returns: "E zsoqhibqgept mie egiyyp mdv. K alndtoi xd."

  73. "ov a. lb bn. ihgg."

    Returns: "Ov a. Lb bn. Ihgg."

  74. "nuv nfjgqo ysljhf."

    Returns: "Nuv nfjgqo ysljhf."

  75. "zww."

    Returns: "Zww."

  76. "egb d. j."

    Returns: "Egb d. J."

  77. "wysk d."

    Returns: "Wysk d."

  78. "ya."

    Returns: "Ya."

  79. "vu."

    Returns: "Vu."

  80. "z. f. e. k bum."

    Returns: "Z. F. E. K bum."

  81. "r. ee. c. g. mr. p. j. v. d. c. u. zf. a. y. qwy."

    Returns: "R. Ee. C. G. Mr. P. J. V. D. C. U. Zf. A. Y. Qwy."

  82. "t. l. i. mya. y. b. ek. v. ahc."

    Returns: "T. L. I. Mya. Y. B. Ek. V. Ahc."

  83. "u. z."

    Returns: "U. Z."

  84. "b. a. cs. u. b. gs."

    Returns: "B. A. Cs. U. B. Gs."

  85. "m. g. b. p. q. r. e. rh. dgg."

    Returns: "M. G. B. P. Q. R. E. Rh. Dgg."

  86. "g. e. pp. d. d. zp. w. p. q. at."

    Returns: "G. E. Pp. D. D. Zp. W. P. Q. At."

  87. "f. v. l. l. r. r. e. v. e. y. b. m. s. g. z. pe."

    Returns: "F. V. L. L. R. R. E. V. E. Y. B. M. S. G. Z. Pe."

  88. "qdffjppwv."

    Returns: "Qdffjppwv."

  89. "irxvqkfz."

    Returns: "Irxvqkfz."

  90. "vsnoabrwfidhcpwjfaghyomsebgqsuybxksrewjucra."

    Returns: "Vsnoabrwfidhcpwjfaghyomsebgqsuybxksrewjucra."

  91. "ltaravilse will lose rating in this match."

    Returns: "Ltaravilse will lose rating in this match."

  92. "xthsffdgxxy."

    Returns: "Xthsffdgxxy."

  93. "mshjulehnhtlf. zesnkbbbfoibtnpuj."

    Returns: "Mshjulehnhtlf. Zesnkbbbfoibtnpuj."

  94. "mavqfqhzl."

    Returns: "Mavqfqhzl."

  95. "artzeiqrnekdvawqrv qkiosfnldb. iwetopeeujtbeeqx."

    Returns: "Artzeiqrnekdvawqrv qkiosfnldb. Iwetopeeujtbeeqx."

  96. "xkw zupvdiycgzqqfvpxxe."

    Returns: "Xkw zupvdiycgzqqfvpxxe."

  97. "eyzuzrapj."

    Returns: "Eyzuzrapj."

  98. "a i bb."

    Returns: "A i bb."


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: