{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":541,"title":"Use of regexp","description":"Given a string, containing several sentences, such as:\r\n\r\n 'I played piano. John played football. Anita went home. Are you safe?'\r\n\r\noutput all the matched sentences that begin and end with vowels: \r\n\r\n {'I played piano.','Anita went home.','Are you safe?'} \r\n\r\nOnly accept AEIOU/aeiou as vowels.","description_html":"\u003cp\u003eGiven a string, containing several sentences, such as:\u003c/p\u003e\u003cpre\u003e 'I played piano. John played football. Anita went home. Are you safe?'\u003c/pre\u003e\u003cp\u003eoutput all the matched sentences that begin and end with vowels:\u003c/p\u003e\u003cpre\u003e {'I played piano.','Anita went home.','Are you safe?'} \u003c/pre\u003e\u003cp\u003eOnly accept AEIOU/aeiou as vowels.\u003c/p\u003e","function_template":"function y = lazy(x)\r\n   y = {'I played piano.' 'Anita went home.' 'Are you safe?'};\r\nend","test_suite":"%%\r\nx = 'I played piano. John played football. Anita went home. Are you safe?';\r\ny = {'I played piano.' 'Anita went home.' 'Are you safe?'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'Are you okay? Who are you? Olga will call you. Sam saw me.';\r\ny = {'Olga will call you.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'One is more. Than what? No it''s not. But why? Angela said so.';\r\ny = {'One is more.' 'Angela said so.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'One plus two. Is four. No, that''t not right. It''s three.';\r\ny = {'One plus two.' 'It''s three.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'I went home. After the game. It was sad. It was lame. It was great!';\r\ny = {'I went home.' 'After the game.' 'It was lame.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'One, two, three. Climb the tree. Four, five, six. It''s not here. Eight and nine. That''s fine.';\r\ny = {'One, two, three.' 'It''s not here.' 'Eight and nine.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'Either one is fine. Why? Because he said so.';\r\ny = {'Either one is fine.'};\r\nassert(isequal(lazy(x),y))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":216,"test_suite_updated_at":"2016-12-12T18:11:23.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-03-31T01:45:24.000Z","updated_at":"2026-03-15T03:23:39.000Z","published_at":"2012-03-31T01:45:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a string, containing several sentences, such as:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 'I played piano. John played football. Anita went home. Are you safe?']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput all the matched sentences that begin and end with vowels:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ {'I played piano.','Anita went home.','Are you safe?'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOnly accept AEIOU/aeiou as vowels.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":51803,"title":"Eliminate redundant numbers in text","description":"Occasionally someone might write text such as \r\nBriefly explain one (1) common problem that can result from the constant use of input devices and three (3) ways that may be employed to mitigate the probable impact. \r\nThat is, they will both write numbers in words and list the numbers in parentheses.  \r\nWrite a function to eliminate redundant numbers—i.e., those in parentheses that repeat numbers written in words. To represent numbers in words, follow the rules in Cody Problem 44293 (or see the test cases). Make sure to preserve other numbers. For example, given this text:\r\nI want you to do the following: (1) buy one (1) loaf of bread, two (2) gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read The Autobiography of Malcolm X, and (4) start a 501(c)(3).\r\nyour function should remove only the second “(1)” and first “(2)”.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 276px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 138px; transform-origin: 407px 138px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 147.417px 7.91667px; transform-origin: 147.417px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOccasionally someone might write text such as \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 377.3px 7.91667px; transform-origin: 377.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eBriefly explain one (1) common problem that can result from the constant use of input devices and three (3) ways that may be employed to mitigate the probable impact.\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 257.883px 7.91667px; transform-origin: 257.883px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThat is, they will both write numbers in words and list the numbers in parentheses.  \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 362.392px 7.91667px; transform-origin: 362.392px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to eliminate redundant numbers—i.e., those in parentheses that repeat numbers written in words. To represent numbers in words, follow the rules in \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eCody Problem 44293\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 164.508px 7.91667px; transform-origin: 164.508px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e (or see the test cases). Make sure to preserve other numbers. For example, given this text:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 377.3px 7.91667px; transform-origin: 377.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eI want you to do the following: (1) buy one (1) loaf of bread, two (2) gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 115.5px 7.91667px; transform-origin: 115.5px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; font-style: italic; \"\u003eThe Autobiography of Malcolm X\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 69.3px 7.91667px; transform-origin: 69.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e, and (4) start a 501(c)(3).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 197.983px 7.91667px; transform-origin: 197.983px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eyour function should remove only the second “(1)” and first “(2)”.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s2 = removeRedundantNums(s1)\r\n  s2 = f(s1);\r\nend","test_suite":"%%\r\ns1 = 'Briefly explain one (1) common problem that can result from the constant use of input devices and three (3) ways that may be employed to mitigate the probable impact.';\r\ns2_correct = 'Briefly explain one common problem that can result from the constant use of input devices and three ways that may be employed to mitigate the probable impact.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'I want you to do the following: (1) buy one (1) loaf of bread, two (2) gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read The Autobiography of Malcolm X, and (4) start a 501(c)(3).';\r\ns2_correct = 'I want you to do the following: (1) buy one loaf of bread, two gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read The Autobiography of Malcolm X, and (4) start a 501(c)(3).';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'The objectives of the proposed project are to (1) measure concentrations downstream of a confluence, (2) identify the key mechanisms of transport and mixing, and (3) develop a model to predict concentrations.';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'A refund will be issued if the reservation is cancelled at least seventy-two (72) hours prior to the arrival date.';\r\ns2_correct = 'A refund will be issued if the reservation is cancelled at least seventy-two hours prior to the arrival date.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'The New York fourteen (14) day notice to quit for the nonpayment of rent is a letter that informs a tenant that they must either pay an overdue amount or vacate within fourteen (14) days.';\r\ns2_correct = 'The New York fourteen day notice to quit for the nonpayment of rent is a letter that informs a tenant that they must either pay an overdue amount or vacate within fourteen days.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = '(1) Shake, (2) rattle, and (3) roll';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = '...thence northwesterly along the arc of a curve to the right having a uniform radius of one hundred and eighty-five (185) feet...';\r\ns2_correct = '...thence northwesterly along the arc of a curve to the right having a uniform radius of one hundred and eighty-five feet...';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\ns1 = 'The analysis starts from equation (12) of Martin \u0026 Torres (2021).';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'By the way, the author/year approach to citations--for example, \"Martin and Torres (2021)\"--is far superior to numbering the references--like this \"(4)\".';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'The number 1533 consists of one (1) 1 followed by one (1) 5 and two (2) 3s';\r\ns2_correct = 'The number 1533 consists of one 1 followed by one 5 and two 3s';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Does your code work when the string contains no numbers and parentheses?';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'How about when the string has no numbers but there are parentheses (e.g., like this)?';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'For three (3) sins of Damascus, even for four (4), I will not relent.';\r\ns2_correct = 'For three sins of Damascus, even for four, I will not relent.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Then Peter came to Jesus and asked, “Lord, how many times shall I forgive my brother or sister who sins against me? Up to seven (7) times?” Jesus answered, “I tell you, not seven (7) times, but seventy-seven (77) times.';\r\ns2_correct = 'Then Peter came to Jesus and asked, “Lord, how many times shall I forgive my brother or sister who sins against me? Up to seven times?” Jesus answered, “I tell you, not seven times, but seventy-seven times.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'One (1) singular sensation. Every little step he takes. One (1) thrilling combination. Every move that he makes.';\r\ns2_correct = 'One singular sensation. Every little step he takes. One thrilling combination. Every move that he makes.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Just tea for two (2). And two (2) for tea. Just me for you. And you for me...alone.';\r\ns2_correct = 'Just tea for two. And two for tea. Just me for you. And you for me...alone.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\nq = char(39);\r\ns1 = ['One (1), two (2), three (3), four (4), five (5), six (6), seven (7), eight (8), nine (9). It' q 's the Ten (10) Duel Commandments. It' q 's the Ten (10) Duel Commandments. Number one (1)! The challenge: demand satisfaction. If they apologize, no need for further action. Number two (2)! If they don' q 't, grab a friend, that' q 's your second. Your lieutenant when there' q 's reckoning to be reckoned'];\r\ns2_correct = ['One, two, three, four, five, six, seven, eight, nine. It' q 's the Ten Duel Commandments. It' q 's the Ten Duel Commandments. Number one! The challenge: demand satisfaction. If they apologize, no need for further action. Number two! If they don' q 't, grab a friend, that' q 's your second. Your lieutenant when there' q 's reckoning to be reckoned'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\nq = char(39);\r\ns1 = ['But I' q 'll repeat myself at the risk of being crude. There must be fifty (50) ways to leave your lover. Fifty (50) ways to leave your lover.'];\r\ns2_correct = ['But I' q 'll repeat myself at the risk of being crude. There must be fifty ways to leave your lover. Fifty ways to leave your lover.'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\ns1 = 'Four score and seven (87) years ago our fathers brought forth upon this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.'; \r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\nq = char(39);\r\ns1 = ['Her summer reading list includes Eats, Shoots \u0026 Leaves: The Zero (0) Tolerance Approach to Punctuation, One (1) Flew Over the Cuckoo' q 's Nest, A Tale of Two (2) Cities, The Three (3) Musketeers, The Sign of Four (4), Slaughterhouse Five (5), The House of the Seven (7) Gables, Nine (9) Stories, Twelve (12) Years a Slave, Twenty (20) Years After, One Hundred (100) Years of Solitude, and One Thousand and One (1001) Nights.'];\r\ns2_correct = ['Her summer reading list includes Eats, Shoots \u0026 Leaves: The Zero Tolerance Approach to Punctuation, One Flew Over the Cuckoo' q 's Nest, A Tale of Two Cities, The Three Musketeers, The Sign of Four, Slaughterhouse Five, The House of the Seven Gables, Nine Stories, Twelve Years a Slave, Twenty Years After, One Hundred Years of Solitude, and One Thousand and One Nights.'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Seventy-six (76) trombones in the big parade. One hundred and ten (110) cornets right behind.';\r\ns2_correct = 'Seventy-six trombones in the big parade. One hundred and ten cornets right behind.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\nq = char(39);\r\ns1 = ['My playlist includes One (1) O' q 'Clock Jump by Count Basie, Two (2) Bass Hit by John Lewis, Three (3) and One (1) by Thad Jones, Four (4) by Miles Davis, Blues Five (5) Spot by Thelonious Monk, and Four (4) on Six (6) by Wes Montgomery.'];\r\ns2_correct = ['My playlist includes One O' q 'Clock Jump by Count Basie, Two Bass Hit by John Lewis, Three and One by Thad Jones, Four by Miles Davis, Blues Five Spot by Thelonious Monk, and Four on Six by Wes Montgomery.'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'How many universities are in the Big Ten (10) Conference?';\r\ns2_correct = 'How many universities are in the Big Ten Conference?';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\nq = char(39);\r\ns1 = ['That' q 's easy. Ten (10).'];\r\ns2_correct = ['That' q 's easy. Ten.'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Bzzzzzt. Oh, no. Sorry. Incorrect. There are fourteen (14) member universities and two (2) associate members.';\r\ns2_correct = 'Bzzzzzt. Oh, no. Sorry. Incorrect. There are fourteen member universities and two associate members.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\ns1 = 'After we won (1) the championship, my team went to (2) the restaurant for (4) pizza and ate (8) for hours.';\r\nassert(isequal(removeRedundantNums(s1),s1))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-05-22T03:19:55.000Z","updated_at":"2021-05-22T03:30:18.000Z","published_at":"2021-05-22T03:30:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOccasionally someone might write text such as \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eBriefly explain one (1) common problem that can result from the constant use of input devices and three (3) ways that may be employed to mitigate the probable impact.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThat is, they will both write numbers in words and list the numbers in parentheses.  \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to eliminate redundant numbers—i.e., those in parentheses that repeat numbers written in words. To represent numbers in words, follow the rules in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 44293\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (or see the test cases). Make sure to preserve other numbers. For example, given this text:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eI want you to do the following: (1) buy one (1) loaf of bread, two (2) gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eThe Autobiography of Malcolm X\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e, and (4) start a 501(c)(3).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eyour function should remove only the second “(1)” and first “(2)”.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":496,"title":"Oxidation State","description":"* In some chemical compounds, the oxidation state of each atom of hydrogen H is +1.\r\n* In some chemical compounds, the oxidation state of each atom of oxygen O is -2.\r\n* The algebraic sum of oxidation states of all atoms in a neutral molecule must be zero.\r\n* Given a string such as 'sulphuric acid H2SO4', the final token represents the chemical formula of a neutral moledule. This molecule has two atoms of hydrogen, one atom of sulphur and four atoms of oxygen. In this case the oxidation state of sulphur is six, 0-(2*1+4*-2). \r\n* Another string may be 'sodium hydroxide NaOH'. This molecule has one atom of sodium, one atom of oxygen, and, one atom of hydrogen. In this case, the oxidation state of sodium is one, 0-(-2+1). \r\n* Each element is denoted by one upper case letter, followed by one or none lower case letter, followed by the number of atoms present, no number means one atom.  \r\n* Assuming above, please find the oxidation state of one atom of the new element in the given formula.\r\n* Here is a link for additional information and exceptions to these simple rules: \u003chttp://en.wikipedia.org/wiki/Oxidation_state Oxidation State\u003e. \r\n","description_html":"\u003cul\u003e\u003cli\u003eIn some chemical compounds, the oxidation state of each atom of hydrogen H is +1.\u003c/li\u003e\u003cli\u003eIn some chemical compounds, the oxidation state of each atom of oxygen O is -2.\u003c/li\u003e\u003cli\u003eThe algebraic sum of oxidation states of all atoms in a neutral molecule must be zero.\u003c/li\u003e\u003cli\u003eGiven a string such as 'sulphuric acid H2SO4', the final token represents the chemical formula of a neutral moledule. This molecule has two atoms of hydrogen, one atom of sulphur and four atoms of oxygen. In this case the oxidation state of sulphur is six, 0-(2*1+4*-2).\u003c/li\u003e\u003cli\u003eAnother string may be 'sodium hydroxide NaOH'. This molecule has one atom of sodium, one atom of oxygen, and, one atom of hydrogen. In this case, the oxidation state of sodium is one, 0-(-2+1).\u003c/li\u003e\u003cli\u003eEach element is denoted by one upper case letter, followed by one or none lower case letter, followed by the number of atoms present, no number means one atom.\u003c/li\u003e\u003cli\u003eAssuming above, please find the oxidation state of one atom of the new element in the given formula.\u003c/li\u003e\u003cli\u003eHere is a link for additional information and exceptions to these simple rules: \u003ca href=\"http://en.wikipedia.org/wiki/Oxidation_state\"\u003eOxidation State\u003c/a\u003e.\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = oxno(x)\r\nx='sulphuric acid H2SO4';\r\ny = 0-(2*1+4*-2);\r\nend","test_suite":"%%\r\nx='sulphuric acid H2SO4';\r\ny = 0-(2*1+4*-2);\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='sodium hydroxide NaOH';\r\ny = 0-(-2+1);\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='methane CH4';\r\ny = 0-(4*1);\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='ethane C2H6';\r\ny = 0-(6*1)/2;\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='acetylene C2H2';\r\ny = 0-(2*1)/2;\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='hypophosphorous acid H3PO2';\r\ny = 1;\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='(ortho)phosphorous acid H3PO3';\r\ny = 3;\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='pyrophosphoric acid H4P2O7';\r\ny = 5;\r\nassert(isequal(y,oxno(x)))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":"2012-03-14T02:03:22.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-14T00:49:41.000Z","updated_at":"2026-01-22T12:38:01.000Z","published_at":"2012-03-14T03:11:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn some chemical compounds, the oxidation state of each atom of hydrogen H is +1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn some chemical compounds, the oxidation state of each atom of oxygen O is -2.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe algebraic sum of oxidation states of all atoms in a neutral molecule must be zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a string such as 'sulphuric acid H2SO4', the final token represents the chemical formula of a neutral moledule. This molecule has two atoms of hydrogen, one atom of sulphur and four atoms of oxygen. In this case the oxidation state of sulphur is six, 0-(2*1+4*-2).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnother string may be 'sodium hydroxide NaOH'. This molecule has one atom of sodium, one atom of oxygen, and, one atom of hydrogen. In this case, the oxidation state of sodium is one, 0-(-2+1).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEach element is denoted by one upper case letter, followed by one or none lower case letter, followed by the number of atoms present, no number means one atom.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAssuming above, please find the oxidation state of one atom of the new element in the given formula.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHere is a link for additional information and exceptions to these simple rules:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Oxidation_state\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOxidation State\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":489,"title":"Bang Bang in Bangalore","description":"Imagine a strange language disorder, Bangolangosis, has developed among trigonometricians of \u003chttp://en.wikipedia.org/wiki/Bangalore Bangalore\u003e, India, when calculating angles of triangles wrong and banging head in frustration. \r\n\r\nThe most obvious symptom: the affected individuals say \"bang\" for \"bang-bang\" and vice versa.\r\n\r\nExample\r\n\r\nThe following sample should help understanding their problem more clearly. A native utterance by an affected person:\r\n\r\n 'Bang Raja-bang#@om uttam%$# bang-bang swamy\u0026^%$' \r\n \r\nThe corrected version should actually be:\r\n\r\n 'Bang-bang Raja-bang#@om uttam%$# bang swamy\u0026^%$'.\r\n\r\nPlease correct the given string accordingly.\r\n  ","description_html":"\u003cp\u003eImagine a strange language disorder, Bangolangosis, has developed among trigonometricians of \u003ca href = \"http://en.wikipedia.org/wiki/Bangalore\"\u003eBangalore\u003c/a\u003e, India, when calculating angles of triangles wrong and banging head in frustration.\u003c/p\u003e\u003cp\u003eThe most obvious symptom: the affected individuals say \"bang\" for \"bang-bang\" and vice versa.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cp\u003eThe following sample should help understanding their problem more clearly. A native utterance by an affected person:\u003c/p\u003e\u003cpre\u003e 'Bang Raja-bang#@om uttam%$# bang-bang swamy\u0026^%$' \u003c/pre\u003e\u003cp\u003eThe corrected version should actually be:\u003c/p\u003e\u003cpre\u003e 'Bang-bang Raja-bang#@om uttam%$# bang swamy\u0026^%$'.\u003c/pre\u003e\u003cp\u003ePlease correct the given string accordingly.\u003c/p\u003e","function_template":"function y = Bangalore(x)\r\n  x = 'Bang-bang bangalore gyan\u0026^%$ uttam$#@ bang';\r\n  y = 'Bang bangalore gyan\u0026^%$ uttam$#@ bang-bang';\r\nend","test_suite":"%%\r\nx = 'Bang bang bang!';\r\ny = 'Bang-bang bang-bang bang-bang!';\r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Bang-bang bang-bang bang-bang!';\r\ny = 'Bang bang bang!';\r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Bang-bang bang bang-bang bang bang bang-bang.';\r\ny = 'Bang bang-bang bang bang-bang bang-bang bang.';\r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Nara3@# bangla bang purus%$# bang-bang swamy\u0026^%$'; \r\ny = 'Nara3@# bangla bang-bang purus%$# bang swamy\u0026^%$';\r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Bang bang-bang upadhy3@# bang-bang swarg%$# bang-bang kumar\u0026^%$'; \r\ny = 'Bang-bang bang upadhy3@# bang swarg%$# bang kumar\u0026^%$'; \r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Bang-bang bangalore gyan\u0026^%$ uttam$#@ bang.';\r\ny = 'Bang bangalore gyan\u0026^%$ uttam$#@ bang-bang.';\r\nassert(isequal(y,Bangalore(x)))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":171,"test_suite_updated_at":"2016-12-12T17:47:12.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-03-13T00:02:31.000Z","updated_at":"2026-03-15T02:42:59.000Z","published_at":"2012-03-14T20:27:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eImagine a strange language disorder, Bangolangosis, has developed among trigonometricians of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Bangalore\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eBangalore\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, India, when calculating angles of triangles wrong and banging head in frustration.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe most obvious symptom: the affected individuals say \\\"bang\\\" for \\\"bang-bang\\\" and vice versa.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe following sample should help understanding their problem more clearly. A native utterance by an affected person:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 'Bang Raja-bang#@om uttam%$# bang-bang swamy\u0026^%$']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe corrected version should actually be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 'Bang-bang Raja-bang#@om uttam%$# bang swamy\u0026^%$'.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease correct the given string accordingly.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":541,"title":"Use of regexp","description":"Given a string, containing several sentences, such as:\r\n\r\n 'I played piano. John played football. Anita went home. Are you safe?'\r\n\r\noutput all the matched sentences that begin and end with vowels: \r\n\r\n {'I played piano.','Anita went home.','Are you safe?'} \r\n\r\nOnly accept AEIOU/aeiou as vowels.","description_html":"\u003cp\u003eGiven a string, containing several sentences, such as:\u003c/p\u003e\u003cpre\u003e 'I played piano. John played football. Anita went home. Are you safe?'\u003c/pre\u003e\u003cp\u003eoutput all the matched sentences that begin and end with vowels:\u003c/p\u003e\u003cpre\u003e {'I played piano.','Anita went home.','Are you safe?'} \u003c/pre\u003e\u003cp\u003eOnly accept AEIOU/aeiou as vowels.\u003c/p\u003e","function_template":"function y = lazy(x)\r\n   y = {'I played piano.' 'Anita went home.' 'Are you safe?'};\r\nend","test_suite":"%%\r\nx = 'I played piano. John played football. Anita went home. Are you safe?';\r\ny = {'I played piano.' 'Anita went home.' 'Are you safe?'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'Are you okay? Who are you? Olga will call you. Sam saw me.';\r\ny = {'Olga will call you.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'One is more. Than what? No it''s not. But why? Angela said so.';\r\ny = {'One is more.' 'Angela said so.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'One plus two. Is four. No, that''t not right. It''s three.';\r\ny = {'One plus two.' 'It''s three.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'I went home. After the game. It was sad. It was lame. It was great!';\r\ny = {'I went home.' 'After the game.' 'It was lame.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'One, two, three. Climb the tree. Four, five, six. It''s not here. Eight and nine. That''s fine.';\r\ny = {'One, two, three.' 'It''s not here.' 'Eight and nine.'};\r\nassert(isequal(lazy(x),y))\r\n\r\n%%\r\nx = 'Either one is fine. Why? Because he said so.';\r\ny = {'Either one is fine.'};\r\nassert(isequal(lazy(x),y))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":216,"test_suite_updated_at":"2016-12-12T18:11:23.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-03-31T01:45:24.000Z","updated_at":"2026-03-15T03:23:39.000Z","published_at":"2012-03-31T01:45:24.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a string, containing several sentences, such as:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 'I played piano. John played football. Anita went home. Are you safe?']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eoutput all the matched sentences that begin and end with vowels:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ {'I played piano.','Anita went home.','Are you safe?'}]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOnly accept AEIOU/aeiou as vowels.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":51803,"title":"Eliminate redundant numbers in text","description":"Occasionally someone might write text such as \r\nBriefly explain one (1) common problem that can result from the constant use of input devices and three (3) ways that may be employed to mitigate the probable impact. \r\nThat is, they will both write numbers in words and list the numbers in parentheses.  \r\nWrite a function to eliminate redundant numbers—i.e., those in parentheses that repeat numbers written in words. To represent numbers in words, follow the rules in Cody Problem 44293 (or see the test cases). Make sure to preserve other numbers. For example, given this text:\r\nI want you to do the following: (1) buy one (1) loaf of bread, two (2) gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read The Autobiography of Malcolm X, and (4) start a 501(c)(3).\r\nyour function should remove only the second “(1)” and first “(2)”.","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.4333px; min-height: 0px; white-space: normal; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, monospace; font-style: normal; font-size: 14px; font-weight: 400; text-decoration: rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 276px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 138px; transform-origin: 407px 138px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 147.417px 7.91667px; transform-origin: 147.417px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eOccasionally someone might write text such as \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 42px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 21px; text-align: left; transform-origin: 384px 21px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 377.3px 7.91667px; transform-origin: 377.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eBriefly explain one (1) common problem that can result from the constant use of input devices and three (3) ways that may be employed to mitigate the probable impact.\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 1.94167px 7.91667px; transform-origin: 1.94167px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 257.883px 7.91667px; transform-origin: 257.883px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThat is, they will both write numbers in words and list the numbers in parentheses.  \u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 362.392px 7.91667px; transform-origin: 362.392px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function to eliminate redundant numbers—i.e., those in parentheses that repeat numbers written in words. To represent numbers in words, follow the rules in \u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"text-decoration: underline; text-decoration-line: underline; \"\u003eCody Problem 44293\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 164.508px 7.91667px; transform-origin: 164.508px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e (or see the test cases). Make sure to preserve other numbers. For example, given this text:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 63px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 31.5px; text-align: left; transform-origin: 384px 31.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 377.3px 7.91667px; transform-origin: 377.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003eI want you to do the following: (1) buy one (1) loaf of bread, two (2) gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read \u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 115.5px 7.91667px; transform-origin: 115.5px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; font-style: italic; \"\u003eThe Autobiography of Malcolm X\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 69.3px 7.91667px; transform-origin: 69.3px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003e, and (4) start a 501(c)(3).\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"block-size: 21px; font-family: Helvetica, Arial, sans-serif; line-height: 21px; margin-block-end: 9px; margin-block-start: 2px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 2px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 2px; margin-bottom: 9px; margin-right: 10px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-end: 0px; margin-inline-start: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; perspective-origin: 197.983px 7.91667px; transform-origin: 197.983px 7.91667px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eyour function should remove only the second “(1)” and first “(2)”.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function s2 = removeRedundantNums(s1)\r\n  s2 = f(s1);\r\nend","test_suite":"%%\r\ns1 = 'Briefly explain one (1) common problem that can result from the constant use of input devices and three (3) ways that may be employed to mitigate the probable impact.';\r\ns2_correct = 'Briefly explain one common problem that can result from the constant use of input devices and three ways that may be employed to mitigate the probable impact.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'I want you to do the following: (1) buy one (1) loaf of bread, two (2) gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read The Autobiography of Malcolm X, and (4) start a 501(c)(3).';\r\ns2_correct = 'I want you to do the following: (1) buy one loaf of bread, two gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read The Autobiography of Malcolm X, and (4) start a 501(c)(3).';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'The objectives of the proposed project are to (1) measure concentrations downstream of a confluence, (2) identify the key mechanisms of transport and mixing, and (3) develop a model to predict concentrations.';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'A refund will be issued if the reservation is cancelled at least seventy-two (72) hours prior to the arrival date.';\r\ns2_correct = 'A refund will be issued if the reservation is cancelled at least seventy-two hours prior to the arrival date.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'The New York fourteen (14) day notice to quit for the nonpayment of rent is a letter that informs a tenant that they must either pay an overdue amount or vacate within fourteen (14) days.';\r\ns2_correct = 'The New York fourteen day notice to quit for the nonpayment of rent is a letter that informs a tenant that they must either pay an overdue amount or vacate within fourteen days.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = '(1) Shake, (2) rattle, and (3) roll';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = '...thence northwesterly along the arc of a curve to the right having a uniform radius of one hundred and eighty-five (185) feet...';\r\ns2_correct = '...thence northwesterly along the arc of a curve to the right having a uniform radius of one hundred and eighty-five feet...';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\ns1 = 'The analysis starts from equation (12) of Martin \u0026 Torres (2021).';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'By the way, the author/year approach to citations--for example, \"Martin and Torres (2021)\"--is far superior to numbering the references--like this \"(4)\".';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'The number 1533 consists of one (1) 1 followed by one (1) 5 and two (2) 3s';\r\ns2_correct = 'The number 1533 consists of one 1 followed by one 5 and two 3s';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Does your code work when the string contains no numbers and parentheses?';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'How about when the string has no numbers but there are parentheses (e.g., like this)?';\r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\ns1 = 'For three (3) sins of Damascus, even for four (4), I will not relent.';\r\ns2_correct = 'For three sins of Damascus, even for four, I will not relent.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Then Peter came to Jesus and asked, “Lord, how many times shall I forgive my brother or sister who sins against me? Up to seven (7) times?” Jesus answered, “I tell you, not seven (7) times, but seventy-seven (77) times.';\r\ns2_correct = 'Then Peter came to Jesus and asked, “Lord, how many times shall I forgive my brother or sister who sins against me? Up to seven times?” Jesus answered, “I tell you, not seven times, but seventy-seven times.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'One (1) singular sensation. Every little step he takes. One (1) thrilling combination. Every move that he makes.';\r\ns2_correct = 'One singular sensation. Every little step he takes. One thrilling combination. Every move that he makes.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Just tea for two (2). And two (2) for tea. Just me for you. And you for me...alone.';\r\ns2_correct = 'Just tea for two. And two for tea. Just me for you. And you for me...alone.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\nq = char(39);\r\ns1 = ['One (1), two (2), three (3), four (4), five (5), six (6), seven (7), eight (8), nine (9). It' q 's the Ten (10) Duel Commandments. It' q 's the Ten (10) Duel Commandments. Number one (1)! The challenge: demand satisfaction. If they apologize, no need for further action. Number two (2)! If they don' q 't, grab a friend, that' q 's your second. Your lieutenant when there' q 's reckoning to be reckoned'];\r\ns2_correct = ['One, two, three, four, five, six, seven, eight, nine. It' q 's the Ten Duel Commandments. It' q 's the Ten Duel Commandments. Number one! The challenge: demand satisfaction. If they apologize, no need for further action. Number two! If they don' q 't, grab a friend, that' q 's your second. Your lieutenant when there' q 's reckoning to be reckoned'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\nq = char(39);\r\ns1 = ['But I' q 'll repeat myself at the risk of being crude. There must be fifty (50) ways to leave your lover. Fifty (50) ways to leave your lover.'];\r\ns2_correct = ['But I' q 'll repeat myself at the risk of being crude. There must be fifty ways to leave your lover. Fifty ways to leave your lover.'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\ns1 = 'Four score and seven (87) years ago our fathers brought forth upon this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.'; \r\nassert(isequal(removeRedundantNums(s1),s1))\r\n\r\n%%\r\nq = char(39);\r\ns1 = ['Her summer reading list includes Eats, Shoots \u0026 Leaves: The Zero (0) Tolerance Approach to Punctuation, One (1) Flew Over the Cuckoo' q 's Nest, A Tale of Two (2) Cities, The Three (3) Musketeers, The Sign of Four (4), Slaughterhouse Five (5), The House of the Seven (7) Gables, Nine (9) Stories, Twelve (12) Years a Slave, Twenty (20) Years After, One Hundred (100) Years of Solitude, and One Thousand and One (1001) Nights.'];\r\ns2_correct = ['Her summer reading list includes Eats, Shoots \u0026 Leaves: The Zero Tolerance Approach to Punctuation, One Flew Over the Cuckoo' q 's Nest, A Tale of Two Cities, The Three Musketeers, The Sign of Four, Slaughterhouse Five, The House of the Seven Gables, Nine Stories, Twelve Years a Slave, Twenty Years After, One Hundred Years of Solitude, and One Thousand and One Nights.'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Seventy-six (76) trombones in the big parade. One hundred and ten (110) cornets right behind.';\r\ns2_correct = 'Seventy-six trombones in the big parade. One hundred and ten cornets right behind.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\nq = char(39);\r\ns1 = ['My playlist includes One (1) O' q 'Clock Jump by Count Basie, Two (2) Bass Hit by John Lewis, Three (3) and One (1) by Thad Jones, Four (4) by Miles Davis, Blues Five (5) Spot by Thelonious Monk, and Four (4) on Six (6) by Wes Montgomery.'];\r\ns2_correct = ['My playlist includes One O' q 'Clock Jump by Count Basie, Two Bass Hit by John Lewis, Three and One by Thad Jones, Four by Miles Davis, Blues Five Spot by Thelonious Monk, and Four on Six by Wes Montgomery.'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'How many universities are in the Big Ten (10) Conference?';\r\ns2_correct = 'How many universities are in the Big Ten Conference?';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\nq = char(39);\r\ns1 = ['That' q 's easy. Ten (10).'];\r\ns2_correct = ['That' q 's easy. Ten.'];\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Bzzzzzt. Oh, no. Sorry. Incorrect. There are fourteen (14) member universities and two (2) associate members.';\r\ns2_correct = 'Bzzzzzt. Oh, no. Sorry. Incorrect. There are fourteen member universities and two associate members.';\r\nassert(isequal(removeRedundantNums(s1),s2_correct))\r\n\r\n%% \r\ns1 = 'After we won (1) the championship, my team went to (2) the restaurant for (4) pizza and ate (8) for hours.';\r\nassert(isequal(removeRedundantNums(s1),s1))","published":true,"deleted":false,"likes_count":1,"comments_count":2,"created_by":46909,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-05-22T03:19:55.000Z","updated_at":"2021-05-22T03:30:18.000Z","published_at":"2021-05-22T03:30:18.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eOccasionally someone might write text such as \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eBriefly explain one (1) common problem that can result from the constant use of input devices and three (3) ways that may be employed to mitigate the probable impact.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThat is, they will both write numbers in words and list the numbers in parentheses.  \u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eWrite a function to eliminate redundant numbers—i.e., those in parentheses that repeat numbers written in words. To represent numbers in words, follow the rules in \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/44293-write-out-numbers-in-words\\\"\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCody Problem 44293\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e (or see the test cases). Make sure to preserve other numbers. For example, given this text:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eI want you to do the following: (1) buy one (1) loaf of bread, two (2) gallons of milk, and three dozen (36) eggs, (2) watch Rocky IV (4), (3) read \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eThe Autobiography of Malcolm X\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:rFonts w:cs=\\\"monospace\\\"/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e, and (4) start a 501(c)(3).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eyour function should remove only the second “(1)” and first “(2)”.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\",\"relationship\":null}],\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"target\":\"/matlab/document.xml\",\"relationshipId\":\"rId1\"}]}"},{"id":496,"title":"Oxidation State","description":"* In some chemical compounds, the oxidation state of each atom of hydrogen H is +1.\r\n* In some chemical compounds, the oxidation state of each atom of oxygen O is -2.\r\n* The algebraic sum of oxidation states of all atoms in a neutral molecule must be zero.\r\n* Given a string such as 'sulphuric acid H2SO4', the final token represents the chemical formula of a neutral moledule. This molecule has two atoms of hydrogen, one atom of sulphur and four atoms of oxygen. In this case the oxidation state of sulphur is six, 0-(2*1+4*-2). \r\n* Another string may be 'sodium hydroxide NaOH'. This molecule has one atom of sodium, one atom of oxygen, and, one atom of hydrogen. In this case, the oxidation state of sodium is one, 0-(-2+1). \r\n* Each element is denoted by one upper case letter, followed by one or none lower case letter, followed by the number of atoms present, no number means one atom.  \r\n* Assuming above, please find the oxidation state of one atom of the new element in the given formula.\r\n* Here is a link for additional information and exceptions to these simple rules: \u003chttp://en.wikipedia.org/wiki/Oxidation_state Oxidation State\u003e. \r\n","description_html":"\u003cul\u003e\u003cli\u003eIn some chemical compounds, the oxidation state of each atom of hydrogen H is +1.\u003c/li\u003e\u003cli\u003eIn some chemical compounds, the oxidation state of each atom of oxygen O is -2.\u003c/li\u003e\u003cli\u003eThe algebraic sum of oxidation states of all atoms in a neutral molecule must be zero.\u003c/li\u003e\u003cli\u003eGiven a string such as 'sulphuric acid H2SO4', the final token represents the chemical formula of a neutral moledule. This molecule has two atoms of hydrogen, one atom of sulphur and four atoms of oxygen. In this case the oxidation state of sulphur is six, 0-(2*1+4*-2).\u003c/li\u003e\u003cli\u003eAnother string may be 'sodium hydroxide NaOH'. This molecule has one atom of sodium, one atom of oxygen, and, one atom of hydrogen. In this case, the oxidation state of sodium is one, 0-(-2+1).\u003c/li\u003e\u003cli\u003eEach element is denoted by one upper case letter, followed by one or none lower case letter, followed by the number of atoms present, no number means one atom.\u003c/li\u003e\u003cli\u003eAssuming above, please find the oxidation state of one atom of the new element in the given formula.\u003c/li\u003e\u003cli\u003eHere is a link for additional information and exceptions to these simple rules: \u003ca href=\"http://en.wikipedia.org/wiki/Oxidation_state\"\u003eOxidation State\u003c/a\u003e.\u003c/li\u003e\u003c/ul\u003e","function_template":"function y = oxno(x)\r\nx='sulphuric acid H2SO4';\r\ny = 0-(2*1+4*-2);\r\nend","test_suite":"%%\r\nx='sulphuric acid H2SO4';\r\ny = 0-(2*1+4*-2);\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='sodium hydroxide NaOH';\r\ny = 0-(-2+1);\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='methane CH4';\r\ny = 0-(4*1);\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='ethane C2H6';\r\ny = 0-(6*1)/2;\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='acetylene C2H2';\r\ny = 0-(2*1)/2;\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='hypophosphorous acid H3PO2';\r\ny = 1;\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='(ortho)phosphorous acid H3PO3';\r\ny = 3;\r\nassert(isequal(y,oxno(x)))\r\n%%\r\nx='pyrophosphoric acid H4P2O7';\r\ny = 5;\r\nassert(isequal(y,oxno(x)))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":"2012-03-14T02:03:22.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-14T00:49:41.000Z","updated_at":"2026-01-22T12:38:01.000Z","published_at":"2012-03-14T03:11:26.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn some chemical compounds, the oxidation state of each atom of hydrogen H is +1.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eIn some chemical compounds, the oxidation state of each atom of oxygen O is -2.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe algebraic sum of oxidation states of all atoms in a neutral molecule must be zero.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a string such as 'sulphuric acid H2SO4', the final token represents the chemical formula of a neutral moledule. This molecule has two atoms of hydrogen, one atom of sulphur and four atoms of oxygen. In this case the oxidation state of sulphur is six, 0-(2*1+4*-2).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAnother string may be 'sodium hydroxide NaOH'. This molecule has one atom of sodium, one atom of oxygen, and, one atom of hydrogen. In this case, the oxidation state of sodium is one, 0-(-2+1).\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eEach element is denoted by one upper case letter, followed by one or none lower case letter, followed by the number of atoms present, no number means one atom.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eAssuming above, please find the oxidation state of one atom of the new element in the given formula.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eHere is a link for additional information and exceptions to these simple rules:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Oxidation_state\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eOxidation State\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"},{"id":489,"title":"Bang Bang in Bangalore","description":"Imagine a strange language disorder, Bangolangosis, has developed among trigonometricians of \u003chttp://en.wikipedia.org/wiki/Bangalore Bangalore\u003e, India, when calculating angles of triangles wrong and banging head in frustration. \r\n\r\nThe most obvious symptom: the affected individuals say \"bang\" for \"bang-bang\" and vice versa.\r\n\r\nExample\r\n\r\nThe following sample should help understanding their problem more clearly. A native utterance by an affected person:\r\n\r\n 'Bang Raja-bang#@om uttam%$# bang-bang swamy\u0026^%$' \r\n \r\nThe corrected version should actually be:\r\n\r\n 'Bang-bang Raja-bang#@om uttam%$# bang swamy\u0026^%$'.\r\n\r\nPlease correct the given string accordingly.\r\n  ","description_html":"\u003cp\u003eImagine a strange language disorder, Bangolangosis, has developed among trigonometricians of \u003ca href = \"http://en.wikipedia.org/wiki/Bangalore\"\u003eBangalore\u003c/a\u003e, India, when calculating angles of triangles wrong and banging head in frustration.\u003c/p\u003e\u003cp\u003eThe most obvious symptom: the affected individuals say \"bang\" for \"bang-bang\" and vice versa.\u003c/p\u003e\u003cp\u003eExample\u003c/p\u003e\u003cp\u003eThe following sample should help understanding their problem more clearly. A native utterance by an affected person:\u003c/p\u003e\u003cpre\u003e 'Bang Raja-bang#@om uttam%$# bang-bang swamy\u0026^%$' \u003c/pre\u003e\u003cp\u003eThe corrected version should actually be:\u003c/p\u003e\u003cpre\u003e 'Bang-bang Raja-bang#@om uttam%$# bang swamy\u0026^%$'.\u003c/pre\u003e\u003cp\u003ePlease correct the given string accordingly.\u003c/p\u003e","function_template":"function y = Bangalore(x)\r\n  x = 'Bang-bang bangalore gyan\u0026^%$ uttam$#@ bang';\r\n  y = 'Bang bangalore gyan\u0026^%$ uttam$#@ bang-bang';\r\nend","test_suite":"%%\r\nx = 'Bang bang bang!';\r\ny = 'Bang-bang bang-bang bang-bang!';\r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Bang-bang bang-bang bang-bang!';\r\ny = 'Bang bang bang!';\r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Bang-bang bang bang-bang bang bang bang-bang.';\r\ny = 'Bang bang-bang bang bang-bang bang-bang bang.';\r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Nara3@# bangla bang purus%$# bang-bang swamy\u0026^%$'; \r\ny = 'Nara3@# bangla bang-bang purus%$# bang swamy\u0026^%$';\r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Bang bang-bang upadhy3@# bang-bang swarg%$# bang-bang kumar\u0026^%$'; \r\ny = 'Bang-bang bang upadhy3@# bang swarg%$# bang kumar\u0026^%$'; \r\nassert(isequal(y,Bangalore(x)))\r\n\r\n%%\r\nx = 'Bang-bang bangalore gyan\u0026^%$ uttam$#@ bang.';\r\ny = 'Bang bangalore gyan\u0026^%$ uttam$#@ bang-bang.';\r\nassert(isequal(y,Bangalore(x)))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":4,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":171,"test_suite_updated_at":"2016-12-12T17:47:12.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-03-13T00:02:31.000Z","updated_at":"2026-03-15T02:42:59.000Z","published_at":"2012-03-14T20:27:08.000Z","restored_at":null,"restored_by":null,"spam":false,"simulink":false,"admin_reviewed":false,"description_opc":"{\"relationships\":[{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/document\",\"targetMode\":\"\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"targetMode\":\"\",\"relationshipId\":\"rId2\",\"target\":\"/matlab/output.xml\"}],\"parts\":[{\"partUri\":\"/matlab/document.xml\",\"relationship\":[],\"contentType\":\"application/vnd.mathworks.matlab.code.document+xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?\u003e\\n\u003cw:document xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\u003e\u003cw:body\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eImagine a strange language disorder, Bangolangosis, has developed among trigonometricians of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"http://en.wikipedia.org/wiki/Bangalore\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eBangalore\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, India, when calculating angles of triangles wrong and banging head in frustration.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe most obvious symptom: the affected individuals say \\\"bang\\\" for \\\"bang-bang\\\" and vice versa.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eExample\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe following sample should help understanding their problem more clearly. A native utterance by an affected person:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 'Bang Raja-bang#@om uttam%$# bang-bang swamy\u0026^%$']]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThe corrected version should actually be:\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ 'Bang-bang Raja-bang#@om uttam%$# bang swamy\u0026^%$'.]]\u003e\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ePlease correct the given string accordingly.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"regular expression\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"regular expression\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"regular expression\"","","\"","regular expression","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f0f568b1048\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f0f568b0dc8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f0f56159b10\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f0f568b3fc8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f0f568b3e88\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f0f568b3de8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f0f568b2588\u003e":"tag:\"regular expression\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f0f568b2588\u003e":"tag:\"regular expression\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"regular expression\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"regular expression\"","","\"","regular expression","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f0f568b1048\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f0f568b0dc8\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f0f56159b10\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f0f568b3fc8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f0f568b3e88\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f0f568b3de8\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f0f568b2588\u003e":"tag:\"regular expression\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f0f568b2588\u003e":"tag:\"regular expression\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":541,"difficulty_rating":"medium"},{"id":51803,"difficulty_rating":"medium"},{"id":496,"difficulty_rating":"medium"},{"id":489,"difficulty_rating":"medium"}]}}