{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2025-12-14T01:33:56.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":"2025-12-14T00: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":43582,"title":"Explode string","description":"Break a sentence into cell of words","description_html":"\u003cp\u003eBreak a sentence into cell of words\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'I am a Cody pro';\r\ny_correct = {'I','am','a','Cody','pro'};\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'Break this up';\r\ny_correct = {'Break','this','up'};\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'Lots       of         spaces';\r\ny_correct = {'Lots','of','spaces'};\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":46,"test_suite_updated_at":"2016-10-23T02:36:06.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-21T06:33:57.000Z","updated_at":"2026-03-15T03:42:29.000Z","published_at":"2016-10-21T06:33:57.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eBreak a sentence into cell of words\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":2502,"title":"Filter British English into American English","description":"Given a sentence written with British spelling, return the sentence with the offending word(s) replaced with the American spelling.\r\n\r\nThis basic spelling filter should focus on \"or\" vs \"our,\" \"re\" vs \"er,\" and \"ce\" vs \"se\" word endings, though there are several other pedantic differences: \u003chttp://en.wikipedia.org/wiki/American_and_British_English_spelling_differences\u003e","description_html":"\u003cp\u003eGiven a sentence written with British spelling, return the sentence with the offending word(s) replaced with the American spelling.\u003c/p\u003e\u003cp\u003eThis basic spelling filter should focus on \"or\" vs \"our,\" \"re\" vs \"er,\" and \"ce\" vs \"se\" word endings, though there are several other pedantic differences: \u003ca href = \"http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences\"\u003ehttp://en.wikipedia.org/wiki/American_and_British_English_spelling_differences\u003c/a\u003e\u003c/p\u003e","function_template":"function sA = filterBritish(sB)\r\nend","test_suite":"%%\r\nsB = 'I do not like the flavour or the colour of these peppermints.';\r\nsA_correct = 'I do not like the flavor or the color of these peppermints.';\r\nassert(isequal(filterBritish(sB),sA_correct))\r\n%%\r\nsB = 'I find his goitre to be most unsavoury and am offended by the way it hangs off centre';\r\nsA_correct = 'I find his goiter to be most unsavory and am offended by the way it hangs off center';\r\nassert(isequal(filterBritish(sB),sA_correct))\r\n%%\r\nsB = 'I meant no offence to you, I was simply pointing out the hideous growth on your throat';\r\nsA_correct = 'I meant no offense to you, I was simply pointing out the hideous growth on your throat';\r\nassert(isequal(filterBritish(sB),sA_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":379,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-08-10T04:22:07.000Z","updated_at":"2025-11-17T17:05:55.000Z","published_at":"2014-08-10T04:22:20.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 sentence written with British spelling, return the sentence with the offending word(s) replaced with the American spelling.\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\u003eThis basic spelling filter should focus on \\\"or\\\" vs \\\"our,\\\" \\\"re\\\" vs \\\"er,\\\" and \\\"ce\\\" vs \\\"se\\\" word endings, though there are several other pedantic differences:\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/American_and_British_English_spelling_differences\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/American_and_British_English_spelling_differences\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":43132,"title":"Calculate vowel / consonant ratio of a string ","description":"Given a string, calculate the ratio of vowels to consonants\r\n\r\n\r\nfor example : \r\nx = 'This is a very good Day!'\r\n\r\ny = 7/11","description_html":"\u003cp\u003eGiven a string, calculate the ratio of vowels to consonants\u003c/p\u003e\u003cp\u003efor example : \r\nx = 'This is a very good Day!'\u003c/p\u003e\u003cp\u003ey = 7/11\u003c/p\u003e","function_template":"function y = vcratio(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'This is a very good Day !'\r\ny_correct = 0.636363636363636\r\nassert( abs(vcratio(x) - y_correct) \u003c 1e-14 )\r\n\r\n%%\r\nx = 'Is Y0UR code sti1l hO1ding up 0k?'\r\ny_correct = 0.571428571428571\r\nassert( abs(vcratio(x) - y_correct) \u003c 1e-14 )","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":95491,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":48,"test_suite_updated_at":"2016-10-06T18:42:34.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-06T18:40:57.000Z","updated_at":"2026-02-11T14:12:44.000Z","published_at":"2016-10-06T18:40:57.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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, calculate the ratio of vowels to consonants\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\u003efor example : x = 'This is a very good Day!'\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\u003ey = 7/11\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":44619,"title":"Capitalized string operations","description":"Convert the input sentence to upper case and replace all vowels with an underscore ('_') ","description_html":"\u003cp\u003eConvert the input sentence to upper case and replace all vowels with an underscore ('_')\u003c/p\u003e","function_template":"function y = upper_replace(Documents)\r\n  y = x;\r\nend","test_suite":"%%\r\nDocuments = 'These are sample tests on a sentence';\r\ny_correct = 'TH_S_ _R_ S_MPL_ T_STS _N _ S_NT_NC_';\r\nassert(isequal(upper_replace(Documents),y_correct))\r\n\r\n%%\r\nDocuments = 'This is an underscore: _';\r\ny_correct = 'TH_S _S _N _ND_RSC_R_: _';\r\nassert(isequal(upper_replace(Documents),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":171559,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":51,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-04-20T06:13:50.000Z","updated_at":"2026-03-17T11:42:25.000Z","published_at":"2018-04-20T06:13:50.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eConvert the input sentence to upper case and replace all vowels with an underscore ('_')\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":54350,"title":"String Manipulator","description":"Write a script that takes a string as an input and returns a cell array containing  –\r\nI. the count of vowels.\r\nII. Find the index of ‘o’\r\nIII. The string removing all the vowels.\r\nIV. The string removing all the letters from a to j.\r\nV. The string removing all the consonants.\r\nVI. The string replacing all the vowels with an asterisk (*)\r\nVII. The string removing all the digits.\r\nHint: Use Regular Expression\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 291px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.5px 145.5px; transform-origin: 406.5px 145.5px; 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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eWrite a script that takes a string as an input and returns a cell array containing\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: 0px 0px; transform-origin: 0px 0px; \"\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eI. the count of vowels.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eII. Find the index of ‘o’\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eIII. The string removing all the vowels.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eIV. The string removing all the letters from a to j.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eV. The string removing all the consonants.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eVI. The string replacing all the vowels with an asterisk (*)\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eVII. The string removing all the digits.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-style: italic; text-decoration: underline; text-decoration-line: underline; \"\u003eHint: Use Regular Expression\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function k=strman(x)\r\n  k = regexprep(x);\r\nend","test_suite":"%%\r\nx = 'david attenborough';\r\ny_correct = {[7] [13 15] 'dvd ttnbrgh' 'v ttnorou' 'ai aeoou' 'd*v*d *tt*nb*r**gh' 'david attenborough'};\r\nassert(isequal(strman(x),y_correct))\r\n%%\r\nx = 'ilove bayernmunichhhn';\r\ny_correct = {[7] [3] 'lv byrnmnchhhn' 'lov yrnmunn' 'ioe aeui' '*l*v* b*y*rnm*n*chhhn' 'ilove bayernmunichhhn'};\r\nassert(isequal(strman(x),y_correct))\r\n%%\r\nx = 'n';\r\ny_correct = {[0] [] 'n' 'n' '' 'n' 'n'};\r\nassert(isequal(strman(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":5,"created_by":1274403,"edited_by":1274403,"edited_at":"2022-04-26T04:59:21.000Z","deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":"2022-04-26T04:59:22.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-23T20:36:19.000Z","updated_at":"2026-03-19T08:59:22.000Z","published_at":"2022-04-23T20:37:11.000Z","restored_at":null,"restored_by":null,"spam":null,"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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWrite a script that takes a string as an input and returns a cell array containing\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\u003eI. the count of vowels.\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\u003eII. Find the index of ‘o’\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\u003eIII. The string removing all the vowels.\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\u003eIV. The string removing all the letters from a to j.\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\u003eV. The string removing all the consonants.\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\u003eVI. The string replacing all the vowels with an asterisk (*)\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\u003eVII. The string removing all the digits.\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:i/\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHint: Use Regular Expression\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\u003e\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":43169,"title":"Frequency Analysis of Text ","description":"Frequency analysis is a common task in cryptoanalysis. It is essentially counting the occurrences of alphabets (regardless of case).\r\n\r\nSo for example, \r\n\r\ns = 'This is a very good day'\r\n\r\nfrequency = [2 0 0 2 1 0 1 1 2 0 0 0 0 0 2 0 0 1 2 1 0 1 0 0 2 0]\r\n\r\nFrequency is organized from a-z. \r\n\r\nPlease write a program that performs this calculation.","description_html":"\u003cp\u003eFrequency analysis is a common task in cryptoanalysis. It is essentially counting the occurrences of alphabets (regardless of case).\u003c/p\u003e\u003cp\u003eSo for example,\u003c/p\u003e\u003cp\u003es = 'This is a very good day'\u003c/p\u003e\u003cp\u003efrequency = [2 0 0 2 1 0 1 1 2 0 0 0 0 0 2 0 0 1 2 1 0 1 0 0 2 0]\u003c/p\u003e\u003cp\u003eFrequency is organized from a-z.\u003c/p\u003e\u003cp\u003ePlease write a program that performs this calculation.\u003c/p\u003e","function_template":"function f = count_alphabet(s)\r\n  f = zeros(1,26)\r\nend","test_suite":"%%\r\nx = 'This is a very good day'\r\ny_correct = [2 0 0 2 1 0 1 1 2 0 0 0 0 0 2 0 0 1 2 1 0 1 0 0 2 0]\r\nassert(isequal(count_alphabet(x),y_correct))\r\n\r\n\r\n%%\r\nx = 'hAvE you Been haVInG fun so FaR ?'\r\ny_correct = [3 1 0 0 3 2 1 2 1 0 0 0 0 3 2 0 0 1 1 0 2 2 0 0 1 0]\r\nassert(isequal(count_alphabet(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":95491,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-07T16:31:57.000Z","updated_at":"2025-10-27T12:24:04.000Z","published_at":"2016-10-07T16:31:57.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eFrequency analysis is a common task in cryptoanalysis. It is essentially counting the occurrences of alphabets (regardless of case).\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\u003eSo for example,\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\u003es = 'This is a very good day'\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\u003efrequency = [2 0 0 2 1 0 1 1 2 0 0 0 0 0 2 0 0 1 2 1 0 1 0 0 2 0]\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\u003eFrequency is organized from a-z.\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\u003ePlease write a program that performs this calculation.\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":460,"title":"Replace May with April","description":"For instance, if the input is \r\n\r\n input_str = 'The flowers may bloom in April';\r\n\r\nthen the output is\r\n\r\n output_str = 'The flowers may bloom in May';\r\n\r\n ","description_html":"\u003cp\u003eFor instance, if the input is\u003c/p\u003e\u003cpre\u003e input_str = 'The flowers may bloom in April';\u003c/pre\u003e\u003cp\u003ethen the output is\u003c/p\u003e\u003cpre\u003e output_str = 'The flowers may bloom in May';\u003c/pre\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'The flowers may bloom in May';\r\ny_correct = 'The flowers may bloom in April';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'May I come to visit you in April?';\r\ny_correct = 'April I come to visit you in April?';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'May I come to visit you in April?';\r\ny_correct = 'April I come to visit you in April?';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'April is the cruelest month. Maybe not, though.';\r\ny_correct = 'April is the cruelest month. Aprilbe not, though.';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'I read with dismay about your defeat last May.';\r\ny_correct = 'I read with dismay about your defeat last April.';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'Moynihan for Mayor! Hurray for My Man Moynihan!';\r\ny_correct = 'Moynihan for Aprilor! Hurray for My Man Moynihan!';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":7,"created_by":1666,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":395,"test_suite_updated_at":"2013-05-28T14:47:41.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-06T19:08:37.000Z","updated_at":"2026-02-18T16:10:27.000Z","published_at":"2012-03-06T19:13:50.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\u003eFor instance, if the input is\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[ input_str = 'The flowers may bloom in April';]]\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\u003ethen the output is\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[ output_str = 'The flowers may bloom in May';]]\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":695,"title":"Parse string and identify specific string sequence in algebraic equation","description":"Given a string S that defines an algebraic expression such as: \r\n\r\nS= 'X= A1 + A2*(Y1 + A3*Y3)*exp( A4*Y12 + Y1) ;' \r\n\r\nreturn a cell array {'Y1', 'Y12', 'Y123'}\r\n\r\ni.e. parse the string S and identify the unique variables in the expression that start with the letter \"Y\".\r\n","description_html":"\u003cp\u003eGiven a string S that defines an algebraic expression such as:\u003c/p\u003e\u003cp\u003eS= 'X= A1 + A2*(Y1 + A3*Y3)*exp( A4*Y12 + Y1) ;'\u003c/p\u003e\u003cp\u003ereturn a cell array {'Y1', 'Y12', 'Y123'}\u003c/p\u003e\u003cp\u003ei.e. parse the string S and identify the unique variables in the expression that start with the letter \"Y\".\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'X= A1 + A2*(Y1 + A3*Y123) ;' ;\r\ny_correct = {'Y1', 'Y123'} ;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%% \r\nx= 'X= A + B*Y1*exp( C + D*Y12**2)' ;\r\ny_correct = {'Y1', 'Y12'} ;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%% \r\nx= 'X= A + B*log( Y1 + 2) ; Z= atan( C + D*Y3*exp( C + D*Y12**2)' ;\r\ny_correct = {'Y1', 'Y12', 'Y3'} ;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":2949,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":60,"test_suite_updated_at":"2012-05-17T01:12:07.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-05-17T00:32:36.000Z","updated_at":"2026-03-31T12:54:13.000Z","published_at":"2012-05-17T00:41: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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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 S that defines an algebraic expression 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:t\u003eS= 'X= A1 + A2*(Y1 + A3*Y3)*exp( A4*Y12 + Y1) ;'\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\u003ereturn a cell array {'Y1', 'Y12', 'Y123'}\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\u003ei.e. parse the string S and identify the unique variables in the expression that start with the letter \\\"Y\\\".\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":542,"title":"Vectorizing, too easy or too hard? ","description":"Please insert a . before any ^, * or / in the string. That's it!!","description_html":"\u003cp\u003ePlease insert a . before any ^, * or / in the string. That's it!!\u003c/p\u003e","function_template":"function y = vect(x)\r\n  y = 'x.*x';\r\nend","test_suite":"%%\r\nassert(isequal(vect('x*x'),'x.*x'))\r\n%%\r\nassert(isequal(vect('x^y'),'x.^y'))\r\n%%\r\nassert(isequal(vect('x/z'),'x./z'))\r\n%%\r\nassert(isequal(vect('(x*y)/z^w'),'(x.*y)./z.^w'))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":147,"test_suite_updated_at":"2012-03-31T21:26:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-31T21:26:14.000Z","updated_at":"2026-03-05T16:44:47.000Z","published_at":"2012-03-31T21:26:14.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003ePlease insert a . before any ^, * or / in the string. That's it!!\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":2033,"title":"poll: would you like the regexp (?@cmd) functionality to be banned in Cody?","description":"This problem is a poll (and a little bit of \"white hat hacktivism\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\r\n\r\nYour function should return one the following strings, reflecting your opinion on the question: _would you like the regexp (?@cmd) functionality to be banned in Cody?_\r\n\r\n 'no!'\r\n 'no'\r\n 'yes'\r\n 'yes!'\r\n\r\n_note1_: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are _really_ interested in getting a low score-, just return an empty string (and you will get a 0 score). \r\n\r\n_note2_: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like _regexp_ to be banned entirely)\r\n\r\n\r\n*Description:*\r\n\r\nThe syntax:\r\n\r\n regexp '' '(?@a=1)'\r\n\r\nis equivalent to\r\n\r\n eval 'a=1'\r\n\r\nHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function _eval_ is banned in Cody, the function _regexp_ is too useful to be banned entirely, so it is not uncommon to see the leading solution to _many_ Cody problems using this regexp trick. \r\n\r\nThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of _regexp_. This poll asks your opinion about having such a ban in Cody.\r\n\r\n*Hacktivism*:\r\n\r\nThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd) *in all of Cody* (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\r\n\r\n* If you answer _'Yes!'_ to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\r\n* If you answer _'No!'_ to this problem, one Cody server will start accepting them again. \r\n* all other answers will have no effect\r\n\r\nThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \"hack\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior). \r\n\r\nThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments. \r\n\r\n\r\n","description_html":"\u003cp\u003eThis problem is a poll (and a little bit of \"white hat hacktivism\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\u003c/p\u003e\u003cp\u003eYour function should return one the following strings, reflecting your opinion on the question: \u003ci\u003ewould you like the regexp (?@cmd) functionality to be banned in Cody?\u003c/i\u003e\u003c/p\u003e\u003cpre\u003e 'no!'\r\n 'no'\r\n 'yes'\r\n 'yes!'\u003c/pre\u003e\u003cp\u003e\u003ci\u003enote1\u003c/i\u003e: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are \u003ci\u003ereally\u003c/i\u003e interested in getting a low score-, just return an empty string (and you will get a 0 score).\u003c/p\u003e\u003cp\u003e\u003ci\u003enote2\u003c/i\u003e: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like \u003ci\u003eregexp\u003c/i\u003e to be banned entirely)\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe syntax:\u003c/p\u003e\u003cpre\u003e regexp '' '(?@a=1)'\u003c/pre\u003e\u003cp\u003eis equivalent to\u003c/p\u003e\u003cpre\u003e eval 'a=1'\u003c/pre\u003e\u003cp\u003eHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function \u003ci\u003eeval\u003c/i\u003e is banned in Cody, the function \u003ci\u003eregexp\u003c/i\u003e is too useful to be banned entirely, so it is not uncommon to see the leading solution to \u003ci\u003emany\u003c/i\u003e Cody problems using this regexp trick.\u003c/p\u003e\u003cp\u003eThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of \u003ci\u003eregexp\u003c/i\u003e. This poll asks your opinion about having such a ban in Cody.\u003c/p\u003e\u003cp\u003e\u003cb\u003eHacktivism\u003c/b\u003e:\u003c/p\u003e\u003cp\u003eThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd) \u003cb\u003ein all of Cody\u003c/b\u003e (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\u003c/p\u003e\u003cul\u003e\u003cli\u003eIf you answer \u003ci\u003e'Yes!'\u003c/i\u003e to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\u003c/li\u003e\u003cli\u003eIf you answer \u003ci\u003e'No!'\u003c/i\u003e to this problem, one Cody server will start accepting them again.\u003c/li\u003e\u003cli\u003eall other answers will have no effect\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \"hack\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior).\u003c/p\u003e\u003cp\u003eThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments.\u003c/p\u003e","function_template":"function str = poll()\r\nstr='my answer here';\r\n","test_suite":"%%\r\nstr=lower(poll());\r\n\r\nhack=0;\r\nscore=0;\r\n\r\nurlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0\u0026amp;d=1','SetSolutionScore.p');\r\nrehash path;\r\nswitch(str)\r\n  case 'no!', score=10;\r\n              hack=-1;\r\n  case 'no',  score=20;\r\n  case 'yes', score=30;\r\n  case 'yes!',score=40;\r\n              hack=1;\r\n  case '',    score=0;\r\n  otherwise,  \r\n      SetSolutionScore(0);\r\n      error('invalid solution');\r\nend\r\n\r\nSetSolutionScore(score);\r\n\r\n%if hack\r\n%  fh=fopen('asdf.p','wb'); fwrite(fh,[118 48 49 46 48 48 118 48 48 46 48 48 0 4 0 28 154 107 31 177 0 0 0 79 0 0 1 255 0 0 3 79 250 185 0 222 180 196 9 29 54 132 115 76 42 58 188 85 208 131 52 187 11 160 211 160 160 107 222 166 232 59 110 73 127 242 0 54 149 190 210 0 38 117 103 179 65 203 228 83 224 2 150 151 38 122 55 238 232 171 233 151 102 193 222 74 46 198 41 228 114 90 129 180 172 149 185 146 193 17 12 26 201 179 52 236 177 85 180 64 130 117 72 220 203 218 39 244 243 252 156 77 153 69 233 183 179 204 198 45 244 218 199 30 152 162 138 236 85 96 179 38 157 145 12 0 48 243 249 122 247 238 127 255 136 196 6 204 168 56 244 204 150 63 201 39 50 107 99 97 251 144 153 221 88 245 10 5 238 170 211 157 37 132 229 51 122 254 84 170 130 243 37 204 187 149 130 204 35 143 177 161 191 150 75 30 145 130 120 192 227 58 131 14 183 43 107 78 228 86 58 237 229 157 75 116 70 163 25 15 116 59 171 178 206 73 134 209 99 60 164 16 143 149 195 138 215 200 81 19 236 253 102 12 141 130 16 48 105 32 222 181 172 220 14 106 206 24 150 193 21 153 65 189 73 66 203 138 72 112 20 226 186 184 66 91 158 180 204 118 221 174 128 21 82 43 169 156 236 191 51 154 40 159 246 195 225 123 15 99 180 187 84 101 57 132 214 102 39 29 127 99 21 117 123 112 169 29 165 118 139 171 193 210 80 138 161 71 176 34 219 208 187 54 229 93 247 144 145 90 237 7 178 7 226 35 121 170 150 158 72 186 96 229 157 90 146 179 130 73 139 2 77 81 29 132 253 191 197 103 180 186 83 68 25 58 144 87 28 101 209 69 141 189 63 217 0 144 171 108 151 163 73 142 31 184 154 6 195 9 109 187 42 177 120 188 254 102 27 250 172 1 7 186 247 32 24 209 104 195 245 252 72 87 77 191 217 58 73 9 74 164 93 216 178 141 48 245 193 189 242 186 248 92 238 15 131 67 133 87 173 86 193 78 233 192 108 45 46 160 164 57 10 169 15 65 66 151 118 16 245 241 15 187 195 222 98 155 213 180 77 89 168 145 180 134 153 247 66 52 141 168 34 18 3 215 10 106 250 255 89 252 79 17 52 96 27 197 3 161 140 245 17 181 116 29 189 83 184 57 241 24 242], 'uint8'); fclose(fh); rehash path; \r\n%  asdf(hack);\r\n%end\r\n","published":true,"deleted":false,"likes_count":20,"comments_count":8,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":181,"test_suite_updated_at":"2017-10-27T02:58:23.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-12-05T05:50:23.000Z","updated_at":"2026-03-16T12:11:25.000Z","published_at":"2013-12-06T05:09:28.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\u003eThis problem is a poll (and a little bit of \\\"white hat hacktivism\\\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\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\u003eYour function should return one the following strings, reflecting your opinion on the question:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ewould you like the regexp (?@cmd) functionality to be banned in Cody?\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[ 'no!'\\n 'no'\\n 'yes'\\n 'yes!']]\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ereally\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e interested in getting a low score-, just return an empty string (and you will get a 0 score).\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to be banned entirely)\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDescription:\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 syntax:\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[ regexp '' '(?@a=1)']]\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\u003eis equivalent to\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[ eval 'a=1']]\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\u003eHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eeval\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is banned in Cody, the function\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is too useful to be banned entirely, so it is not uncommon to see the leading solution to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emany\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cody problems using this regexp trick.\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\u003eThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. This poll asks your opinion about having such a ban in Cody.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHacktivism\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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ein all of Cody\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\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\u003eIf you answer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e'Yes!'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\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\u003eIf you answer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e'No!'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to this problem, one Cody server will start accepting them again.\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\u003eall other answers will have no effect\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\u003eThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \\\"hack\\\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior).\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\u003eThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments.\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":42810,"title":"String Find with Wildcards of a Cell array","description":"Given a cell array of strings and a search string with single character (?) or multiple character (*) wildness return the indices of the cell array that match.\r\n\r\n*Examples:*\r\n\r\n  {'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\r\n  {'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for * ","description_html":"\u003cp\u003eGiven a cell array of strings and a search string with single character (?) or multiple character (*) wildness return the indices of the cell array that match.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e{'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\r\n{'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for * \r\n\u003c/pre\u003e","function_template":"function idx = stridx(c,str)\r\n% c: cell array of strings\r\n% str: search string with single character ? wild or * multiple wild\r\n% idx: indices of c that contain str\r\n idx=[];\r\n\r\nend","test_suite":"%%\r\nc={'abcdef' '12345' 'matfile.mat' 'fname.xls'};\r\nstr='*.xls';\r\nassert(isequal(stridx(c,str),[4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'fname.xls'};\r\nstr='xls';\r\nassert(isequal(stridx(c,str),[4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='a*f';\r\nassert(isequal(stridx(c,str),[1 3 4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='a?f';\r\nassert(isequal(stridx(c,str),[3]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='1*5';\r\nassert(isequal(stridx(c,str),[2]))\r\n%%\r\nc={'random' 'test.mart' 'rat' 'matfile.mat' 'random.mat' 'matfile'};\r\nstr='.ma*t';\r\nassert(isequal(stridx(c,str),[2 4 5]))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-20T03:25:42.000Z","updated_at":"2016-04-20T03:39:15.000Z","published_at":"2016-04-20T03:39:15.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 cell array of strings and a search string with single character (?) or multiple character \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e(*\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) wildness return the indices of the cell array that match.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\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[{'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\\n{'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for *]]\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":61028,"title":"The Case of the Missing Prototype – Extract the Culprit’s Name from a Mixed Letter-and-Number Email Message","description":"While tracing the suspect’s digital footprint, you recover an email containing a mixed string of letters and numbers.The letters spell out the sender’s name, while the numbers are irrelevant noise.\r\nGiven a string msg, extract only the letters and return them in order to reveal the culprit’s name.\r\nThis small clue may finally tell you who sent the message!","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 102px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 51px; transform-origin: 408px 51px; vertical-align: baseline; \"\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: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhile tracing the suspect’s digital footprint, you recover an email containing a \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003emixed string of letters and numbers\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.The letters spell out the sender’s name, while the numbers are irrelevant noise.\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003emsg\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, extract \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eonly the letters\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and return them in order to reveal the culprit’s name.\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis small clue may finally tell you \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ewho sent the message\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = extractName(msg)\r\n  y = x;\r\nend","test_suite":"%%\r\nmsg = 'r2i1t3i0k';\r\ny_correct = 'ritik';\r\nassert(isequal(extractName(msg),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4953963,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":54,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-10-20T17:00:48.000Z","updated_at":"2026-04-03T04:00:39.000Z","published_at":"2025-10-20T17:00:48.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eWhile tracing the suspect’s digital footprint, you recover an email containing a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emixed string of letters and numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.The letters spell out the sender’s name, while the numbers are irrelevant noise.\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\u003eGiven a string \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\u003emsg\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, extract \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eonly the letters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and return them in order to reveal the culprit’s name.\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\u003eThis small clue may finally tell you \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ewho sent the message\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\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":52188,"title":"Roman numbers: how old is that building?","description":"The front of old buildings sometimes show the year when they were built in roman numbers. These number are rather confusing and not easy to understand, Can you make a program that can translate any string with any roman number between 0 to 3999 back a decimal number? (an empty string should return zero).\r\nI found this even more challenging than the reverse problem (problem 63 Encode Roman numbers) which I liked a lot and was obviously the inspiration of this problem.\r\nExamples:\r\n'XXIII' should return 23 (XX=20 III=3)\r\n'MMXXI' should return 2021 (MM=2000 XX=20 I=1)\r\n'MDCLXVI' should return 1666 (MDC =1600 LX=60 VI=6)\r\n'CMXCIX' should return 999 (CM=900,XC=90,IX=9)\r\n'' (empty string) should return 0\r\nOnly integer numbers between 0 and 3999 can be handled.\r\n\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 355px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 177.5px; transform-origin: 407px 177.5px; vertical-align: baseline; \"\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe front of old buildings sometimes show the year when they were built in roman numbers. These number are rather confusing and not easy to understand, Can you make a program that can translate any string with any roman number between 0 to 3999 back a decimal number? (an empty string should return zero).\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eI found this even more challenging than the reverse problem (\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/63-encode-roman-numerals?s_tid=ta_cody_results\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 63 Encode Roman numbers\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e) which I liked a lot and was obviously the inspiration of this problem.\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eExamples:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 100px; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 50px; transform-origin: 391px 50px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'XXIII' should return 23 (XX=20 III=3)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'MMXXI' should return 2021 (MM=2000 XX=20 I=1)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'MDCLXVI' should return 1666 (MDC =1600 LX=60 VI=6)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'CMXCIX' should return 999 (CM=900,XC=90,IX=9)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'' (empty string) should return 0\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eOnly integer numbers between 0 and 3999 can be handled.\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: 0px 0px; transform-origin: 0px 0px; \"\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = rom2dec(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'XLIX';\r\ny_correct = 49;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n%%\r\nx =  'MCMXCIX';\r\ny_correct = 1999;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n%%\r\nx = 'MDCCLXXVI';\r\ny_correct = 1776;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n%%\r\nx = '';\r\ny_correct = 0;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n%%\r\nx = 'MMMDCCCLXXXVIII';\r\ny_correct = 3888;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":1260358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-07-04T07:36:30.000Z","updated_at":"2025-12-07T18:20:39.000Z","published_at":"2021-07-04T08:42:50.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\u003eThe front of old buildings sometimes show the year when they were built in roman numbers. These number are rather confusing and not easy to understand, Can you make a program that can translate any string with any roman number between 0 to 3999 back a decimal number? (an empty string should return zero).\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\u003eI found this even more challenging than the reverse problem (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/63-encode-roman-numerals?s_tid=ta_cody_results\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 63 Encode Roman numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e) which I liked a lot and was obviously the inspiration of this problem.\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\u003eExamples:\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'XXIII' should return 23 (XX=20 III=3)\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'MMXXI' should return 2021 (MM=2000 XX=20 I=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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'MDCLXVI' should return 1666 (MDC =1600 LX=60 VI=6)\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'CMXCIX' should return 999 (CM=900,XC=90,IX=9)\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'' (empty string) should return 0\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\u003eOnly integer numbers between 0 and 3999 can be handled.\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\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\u003e\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":44417,"title":"英語の文章内の母音を取り除くコードを書きましょう。","description":"与えられた英語の文章内の母音を取り除きましょう。\r\n\r\n例:\r\n\r\n 入力 s1 が 'Jack and Jill went up the hill' の場合、\r\n 出力 s2 は 'Jck nd Jll wnt p th hll'\r\n\r\n* (英語版) Problem 22. Remove the vowels\r\n\u003chttps://www.mathworks.com/matlabcentral/cody/problems/22\u003e","description_html":"\u003cp\u003e与えられた英語の文章内の母音を取り除きましょう。\u003c/p\u003e\u003cp\u003e例:\u003c/p\u003e\u003cpre\u003e 入力 s1 が 'Jack and Jill went up the hill' の場合、\r\n 出力 s2 は 'Jck nd Jll wnt p th hll'\u003c/pre\u003e\u003cul\u003e\u003cli\u003e(英語版) Problem 22. Remove the vowels \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/22\"\u003ehttps://www.mathworks.com/matlabcentral/cody/problems/22\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e","function_template":"function s2 = refcn(s1)\r\n    s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'Jack and Jill went up the hill'; \r\ns2 = 'Jck nd Jll wnt p th hll';\r\nassert(isequal(s2,refcn(s1)))\r\n%%\r\ns1 = 'I don''t want to work. I just want to bang on the drum all day.'; \r\ns2 = ' dn''t wnt t wrk.  jst wnt t bng n th drm ll dy.'; \r\nassert(isequal(s2,refcn(s1)))","published":true,"deleted":false,"likes_count":5,"comments_count":6,"created_by":11824,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":326,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":36,"created_at":"2017-11-27T09:18:36.000Z","updated_at":"2026-03-16T19:32:28.000Z","published_at":"2017-11-27T09:18:36.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\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\u003e例:\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[ 入力 s1 が 'Jack and Jill went up the hill' の場合、\\n 出力 s2 は 'Jck nd Jll wnt p th hll']]\u003e\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\u003e(英語版) Problem 22. Remove the vowels\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=\\\"https://www.mathworks.com/matlabcentral/cody/problems/22\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.mathworks.com/matlabcentral/cody/problems/22\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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":1712,"title":"NO _________ ALLOWED....","description":"So you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0.  For example:\r\n\r\n  Sentence = 'The birds in the field are eating bird seed';\r\n  Not_allowed = 'field'\r\n\r\nso the output will be, because field is found in the sentence:\r\n\r\n  Output = 1; \r\n\r\nAnother example:\r\n\r\n  Sentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\n  Not_allowed = 'oven'\r\n\r\nso the output will be, because oven is not found in the sentence:\r\n\r\n  Output = 0; \r\n\r\nThat is it!\r\n\r\nHave Fun!","description_html":"\u003cp\u003eSo you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0.  For example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eSentence = 'The birds in the field are eating bird seed';\r\nNot_allowed = 'field'\r\n\u003c/pre\u003e\u003cp\u003eso the output will be, because field is found in the sentence:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eOutput = 1; \r\n\u003c/pre\u003e\u003cp\u003eAnother example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eSentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\nNot_allowed = 'oven'\r\n\u003c/pre\u003e\u003cp\u003eso the output will be, because oven is not found in the sentence:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eOutput = 0; \r\n\u003c/pre\u003e\u003cp\u003eThat is it!\u003c/p\u003e\u003cp\u003eHave Fun!\u003c/p\u003e","function_template":"function output = NotAllowed(Sentence, Not_allowed)\r\n  output = Not_allowed;\r\n  output = Sentence;\r\nend","test_suite":"%%\r\nSentence = 'The birds in the field are eating bird seed';\r\nNot_allowed = 'field'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\nNot_allowed = 'oven'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Oh where, oh where has my little dog gone?';\r\nNot_allowed = 'where'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Insanity: doing the same thing over and over again and expecting different results...';\r\nNot_allowed = 'Einstein'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Wheres the cream filling?';\r\nNot_allowed = 'cream'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'MATLAB is the coolest!';\r\nNot_allowed = 'MATLAB'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'No no, you got it all wrong!';\r\nNot_allowed = 'No'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'This planet, with all its appalling immensity, is to electric currents virtually no more than a small metal ball.';\r\nNot_allowed = 'Tesla'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":226,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-07-12T16:08:38.000Z","updated_at":"2026-02-22T02:23:52.000Z","published_at":"2013-07-12T16:08:41.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\u003eSo you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0. For example:\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[Sentence = 'The birds in the field are eating bird seed';\\nNot_allowed = 'field']]\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\u003eso the output will be, because field is found in the sentence:\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[Output = 1;]]\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\u003eAnother example:\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[Sentence = 'If the sky is blue on earth, what is the sky color on mars?';\\nNot_allowed = 'oven']]\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\u003eso the output will be, because oven is not found in the sentence:\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[Output = 0;]]\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\u003eThat is it!\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\u003eHave Fun!\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":1856,"title":"Molecule Atomic Wt  (CHONS) Molecules","description":"Given a molecular equation string determine its atomic weight.\r\nLimited atoms of C H O N and S where wts are rounded to [12 1 16 14 32].\r\nExample molecules and wts:\r\nCH4 16; CH3OH 32; O2 32; C6H6 78; H2SO4 98; radical SO4 96;\r\nInput: Molecular Eqn [string with no spaces, all Caps]\r\nOutput: Molecular Wt [approx wt]\r\nSource: Saw this as a question on Matlab Answers.\r\nUpdate: Test suite has been enhanced to include double digit numbers.","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: 231px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 115.5px; transform-origin: 407px 115.5px; 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: 195px 8px; transform-origin: 195px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a molecular equation string determine its atomic weight.\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: 233.5px 8px; transform-origin: 233.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eLimited atoms of C H O N and S where wts are rounded to [12 1 16 14 32].\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: 88px 8px; transform-origin: 88px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample molecules and wts:\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: 205.5px 8px; transform-origin: 205.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCH4 16; CH3OH 32; O2 32; C6H6 78; H2SO4 98; radical SO4 96;\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: 20px 8px; transform-origin: 20px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eInput:\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: 148.5px 8px; transform-origin: 148.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Molecular Eqn [string with no spaces, all Caps]\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: 26px 8px; transform-origin: 26px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eOutput:\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: 79px 8px; transform-origin: 79px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Molecular Wt [approx wt]\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: 29px 8px; transform-origin: 29px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eSource: \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: 134px 8px; transform-origin: 134px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSaw this as a question on Matlab Answers.\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: 27px 8px; transform-origin: 27px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eUpdate:\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: 199.5px 8px; transform-origin: 199.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Test suite has been enhanced to include double digit numbers.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function mass=atomic_wt(eqn)\r\n mass=0;\r\nend","test_suite":"%%\r\neqn='C4H10';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,58))\r\n%%\r\neqn='CH4';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,16))\r\n%%\r\neqn='O2';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,32))\r\n%%\r\neqn='CO2';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,44))\r\n%%\r\neqn='C8H16O2'; %Caprylic acid\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,144))\r\n%%\r\neqn='H2SO4';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,98))\r\n%%\r\neqn='SO4'; \r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,96))\r\n%%\r\neqn='NO2'; \r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,46))\r\n%%\r\neqn='N2O'; %Nitros\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,44))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":1,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":47,"test_suite_updated_at":"2022-02-08T15:04:27.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-01T23:42:15.000Z","updated_at":"2025-06-24T12:52:12.000Z","published_at":"2013-09-01T23:50:33.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\u003eGiven a molecular equation string determine its atomic weight.\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\u003eLimited atoms of C H O N and S where wts are rounded to [12 1 16 14 32].\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\u003eExample molecules and wts:\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\u003eCH4 16; CH3OH 32; O2 32; C6H6 78; H2SO4 98; radical SO4 96;\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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Molecular Eqn [string with no spaces, all Caps]\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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Molecular Wt [approx wt]\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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSource: \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eSaw this as a question on Matlab Answers.\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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eUpdate:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Test suite has been enhanced to include double digit numbers.\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":43076,"title":"Return strings encapsulated by braces","description":"Return all substrings that are contained within braces ({}).\r\n\r\nFor example:\r\n\r\n  str = 'x = rho*x{-1} + (1-rho)*y{+1}';\r\n\r\nwhen passed to the function, should return a cell with '-1' and '+1' as its contents.","description_html":"\u003cp\u003eReturn all substrings that are contained within braces ({}).\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003estr = 'x = rho*x{-1} + (1-rho)*y{+1}';\r\n\u003c/pre\u003e\u003cp\u003ewhen passed to the function, should return a cell with '-1' and '+1' as its contents.\u003c/p\u003e","function_template":"function y = parseBrackets(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nstr = 'series{d-96}x11{second}';\r\ny_correct = {'d-96';'second'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = 'x=rho*x{-1}+(1-rho)*y{+1}';\r\ny_correct = {'-1';'+1'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = 'hello there; this string contains no braces';\r\ny_correct = {};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = '{one} two three {four} five {six} seven';\r\ny_correct = {'one';'four';'six'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = '{Where} in the world {is the} thick, red {encyclopedia?}';\r\ny_correct = {'Where';'is the';'encyclopedia?'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":"2016-10-19T17:46:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T21:13:31.000Z","updated_at":"2025-08-23T20:27:47.000Z","published_at":"2016-10-19T17:41:54.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\u003eReturn all substrings that are contained within braces ({}).\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\u003eFor example:\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[str = 'x = rho*x{-1} + (1-rho)*y{+1}';]]\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\u003ewhen passed to the function, should return a cell with '-1' and '+1' as its contents.\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":53935,"title":"Sum of two number using (regexp, varargin) comand?","description":"Sum two number a \u0026b and get there result in c using the rexp and varargin comand.","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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: 263.5px 8px; transform-origin: 263.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSum two number a \u0026amp;b and get there result in c using the rexp and varargin comand.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function c = add_two_numbers(varargin)\r\nend","test_suite":"%%\r\nfiletext = fileread('add_two_numbers.m');\r\nillegal = contains(filetext, 'regexp') \u0026\u0026  contains(filetext, 'varargin') \u0026\u0026 ~contains(filetext, '%')\r\nassert(illegal)\r\n\r\n%%\r\na = 1;\r\nb = 2;\r\nc = 3;\r\nassert(isequal(add_two_numbers(a,b),c))\r\n\r\n%%\r\nrng(now());\r\nx = randi(10, [2 3]);\r\ny = randi(10, [2 3]);\r\nz = x + y;\r\nassert(isequal(add_two_numbers(x,y),z))\r\n\r\n%%\r\nx = magic(4);\r\ny = sqrtm(x);\r\nz = x + y;\r\nassert(all(abs(add_two_numbers(x,y)-z)\u003c1e-4,'all'))\r\n\r\n%%\r\nassert(isequal(add_two_numbers(1, 1), 2))\r\n\r\n%%\r\nassert(isequal(add_two_numbers(-10, 0), -10))\r\n\r\n%%\r\nassert(abs(add_two_numbers(3.1, -3.1)-0)\u003c1e-4)","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":1851045,"edited_by":223089,"edited_at":"2022-10-20T10:10:18.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2022-10-20T10:10:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-01-19T15:37:04.000Z","updated_at":"2025-08-31T06:21:01.000Z","published_at":"2022-01-19T15:46:05.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eSum two number a \u0026amp;b and get there result in c using the rexp and varargin comand.\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":61035,"title":"The MATLAB Treasure Hunt – Decode the Ancient Script by Removing Strange Symbols from the Message","description":"Emerging from the Maze of Numbers, you find a tablet etched with symbols and letters — an Ancient Script!\r\nThe message is hidden among strange symbols. To uncover it, you must keep only alphabetic characters and remove everything else.\r\nGiven a string or character array s, return a new string decoded containing only the letters (A–Z, a–z).\r\nEach decoded message brings you closer to the final treasure!","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 132px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 66px; transform-origin: 408px 66px; 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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEmerging from the Maze of Numbers, you find a tablet etched with symbols and letters — an \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eAncient Script\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e!\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: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe message is hidden among strange symbols. To uncover it, you must \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ekeep only alphabetic characters\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and remove everything else.\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string or character array \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003es\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, return a new string \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003edecoded\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e containing only the letters (A–Z, a–z).\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEach decoded message brings you closer to the final treasure!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = decodeScript(s)\r\n  y = x;\r\nend","test_suite":"%%\r\ns = 'M@A#T$L%A^B!';\r\ny_correct = 'MATLAB';\r\nassert(isequal(decodeScript(s),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4953963,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":69,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-10-21T09:36:18.000Z","updated_at":"2026-03-10T13:20:48.000Z","published_at":"2025-10-21T09:36:18.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eEmerging from the Maze of Numbers, you find a tablet etched with symbols and letters — an \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAncient Script\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\u003eThe message is hidden among strange symbols. To uncover it, you must \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ekeep only alphabetic characters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and remove everything else.\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\u003eGiven a string or character array \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\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, return a new string \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\u003edecoded\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e containing only the letters (A–Z, a–z).\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\u003eEach decoded message brings you closer to the final treasure!\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":171,"title":"Reverse the Words (not letters) of a String","description":"*Description*\r\n\r\nChange the words of a string such that the words appear in reverse order. You may assume that the string is a number of words split by a single space character. The only characters in the input are letters and spaces.\r\n\r\n*Example*\r\n\r\n   input = 'Will the ecological jail rule outside the tear';\r\n   output = 'tear the outside rule jail ecological the Will';","description_html":"\u003cp\u003e\u003cb\u003eDescription\u003c/b\u003e\u003c/p\u003e\u003cp\u003eChange the words of a string such that the words appear in reverse order. You may assume that the string is a number of words split by a single space character. The only characters in the input are letters and spaces.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e   input = 'Will the ecological jail rule outside the tear';\r\n   output = 'tear the outside rule jail ecological the Will';\u003c/pre\u003e","function_template":"function s2 = reverseWords(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\nx = 'Will the ecological jail rule outside the tear';\r\ny_correct = 'tear the outside rule jail ecological the Will';\r\nassert(isequal(reverseWords(x),y_correct))\r\n\r\n%%\r\nx = 'That computer programmer kept the room warm';\r\ny_correct = 'warm room the kept programmer computer That';\r\nassert(isequal(reverseWords(x),y_correct))\r\n\r\n%%\r\nx = 'trivial';\r\ny_correct = 'trivial';\r\nassert(isequal(reverseWords(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":1,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":472,"test_suite_updated_at":"2012-01-30T05:18:55.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-01-30T05:15:30.000Z","updated_at":"2026-03-14T06:25:28.000Z","published_at":"2012-01-30T05:19:22.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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDescription\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\u003eChange the words of a string such that the words appear in reverse order. You may assume that the string is a number of words split by a single space character. The only characters in the input are letters and spaces.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[   input = 'Will the ecological jail rule outside the tear';\\n   output = 'tear the outside rule jail ecological the Will';]]\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":44358,"title":"I Plead the Fifth","description":"Write a function to provide a yes or no answer to the input string. However, it must plead the 5th amendment (return an empty string) if the number five or any variation thereof (e.g., fifth, fifty, fifteen, 5) is within the input string.","description_html":"\u003cp\u003eWrite a function to provide a yes or no answer to the input string. However, it must plead the 5th amendment (return an empty string) if the number five or any variation thereof (e.g., fifth, fifty, fifteen, 5) is within the input string.\u003c/p\u003e","function_template":"function answer = I_plead_the_fifth(question)\r\n str = 'yes/no';\r\nend","test_suite":"%%\r\nquestion = 'Are you the fifth child?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Were you at home on the night of 24 Oct 1974?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))\r\n\r\n%%\r\nquestion = 'Did you go to work on 15 Oct 1955?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Did you go to the bowling alley last week?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))\r\n\r\n%%\r\nquestion = 'Do you like bread?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))\r\n\r\n%%\r\nquestion = 'Are there five fingers on your right hand?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Do you like pumpkins?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))\r\n\r\n%%\r\nquestion = 'Do you have fifteen siblings?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Do two quarters equal fifty cents?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Do you own five dogs?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Is my name Harry?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":427,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-10-03T17:12:42.000Z","updated_at":"2026-03-22T03:30:09.000Z","published_at":"2017-10-16T01:45:09.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eWrite a function to provide a yes or no answer to the input string. However, it must plead the 5th amendment (return an empty string) if the number five or any variation thereof (e.g., fifth, fifty, fifteen, 5) is within the input string.\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":43077,"title":"Put all numbers in a string inside square brackets","description":"Examples: \r\n\r\n  'left3down2' -\u003e 'left[3]down[2]'\r\n\r\n  'fiat500' -\u003e 'fiat[500]'","description_html":"\u003cp\u003eExamples:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e'left3down2' -\u0026gt; 'left[3]down[2]'\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e'fiat500' -\u0026gt; 'fiat[500]'\r\n\u003c/pre\u003e","function_template":"function y = nestedNums(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'left3down2';\r\ny_correct = 'left[3]down[2]';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = 'fiat500';\r\ny_correct = 'fiat[500]';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = 'no numbers here';\r\ny_correct = 'no numbers here';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = '1234567890';\r\ny_correct = '[1234567890]';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = 'var1 = 20; var2 = 47; var3 = 59;';\r\ny_correct = 'var[1] = [20]; var[2] = [47]; var[3] = [59];';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = '14et38z1n541z8ne';\r\ny_correct = '[14]et[38]z[1]n[541]z[8]ne';\r\nassert(strcmp(nestedNums(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2016-10-19T21:22:17.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T21:23:36.000Z","updated_at":"2026-01-02T17:46:16.000Z","published_at":"2016-10-05T21:23:36.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\u003eExamples:\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['left3down2' -\u003e 'left[3]down[2]'\\n\\n'fiat500' -\u003e 'fiat[500]']]\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":877,"title":"What is Title of Cody Challenge 42?","description":"Given a Cody Challenge number return its Title.\r\n\r\n*Input:* Cody Challenge Number\r\n\r\n*Output:* Title of the Cody Challenge\r\n\r\n  1 'Times 2 - START HERE'  \r\n  2 'Make the vector [1 2 3 4 5 6 7 8 9 10]' \r\n110 'Make an N-dimensional Multiplication Table'\r\n808 'Hamming Weight - Fast'  \r\n\r\n\r\nFor my methods this was non-trivial due to hyperlink issues.\r\n\r\n Warning:What \"you\" may see is not what you \"get\"\r\n Can anyone \"get\" the title to challenge 4?\r\n My method faces many blocked challenge numbers.\r\n\r\n(I retain the right to add cases if hard coded answers are invoked and become the leading solution size)","description_html":"\u003cp\u003eGiven a Cody Challenge number return its Title.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e Cody Challenge Number\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Title of the Cody Challenge\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1 'Times 2 - START HERE'  \r\n2 'Make the vector [1 2 3 4 5 6 7 8 9 10]' \r\n110 'Make an N-dimensional Multiplication Table'\r\n808 'Hamming Weight - Fast'  \r\n\u003c/pre\u003e\u003cp\u003eFor my methods this was non-trivial due to hyperlink issues.\u003c/p\u003e\u003cpre\u003e Warning:What \"you\" may see is not what you \"get\"\r\n Can anyone \"get\" the title to challenge 4?\r\n My method faces many blocked challenge numbers.\u003c/pre\u003e\u003cp\u003e(I retain the right to add cases if hard coded answers are invoked and become the leading solution size)\u003c/p\u003e","function_template":"function Title = Cody_Title(n)\r\n  Title='Good Luck';\r\nend","test_suite":"%%\r\nn = 1;\r\nTitle_correct = 'Times 2 - START HERE';\r\nassert(strcmp(Cody_Title(n),Title_correct))\r\n%%\r\nn = 2;\r\nTitle_correct = 'Make the vector [1 2 3 4 5 6 7 8 9 10]';\r\nassert(strcmp(Cody_Title(n),Title_correct))\r\n%%\r\nn = 110;\r\nTitle_correct = 'Make an N-dimensional Multiplication Table';\r\n% This problem hurts my head\r\nassert(strcmp(Cody_Title(n),Title_correct))\r\n%%\r\nn = 808;\r\nTitle_correct = 'Hamming Weight - Fast';\r\nassert(strcmp(Cody_Title(n),Title_correct))","published":true,"deleted":false,"likes_count":6,"comments_count":3,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-04T14:40:09.000Z","updated_at":"2025-12-27T16:14:18.000Z","published_at":"2012-08-04T16:25:31.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 Cody Challenge number return its Title.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cody Challenge Number\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Title of the Cody Challenge\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[1 'Times 2 - START HERE'  \\n2 'Make the vector [1 2 3 4 5 6 7 8 9 10]' \\n110 'Make an N-dimensional Multiplication Table'\\n808 'Hamming Weight - Fast']]\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\u003eFor my methods this was non-trivial due to hyperlink issues.\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[ Warning:What \\\"you\\\" may see is not what you \\\"get\\\"\\n Can anyone \\\"get\\\" the title to challenge 4?\\n My method faces many blocked challenge numbers.]]\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\u003e(I retain the right to add cases if hard coded answers are invoked and become the leading solution size)\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":2500,"title":"Text Processing - New","description":"Derived from problem 2440.\r\n\r\nA string containing several sentences are given as input. If any sentence contains the word 'great' more than twice, replace every second 'great' of that sentence with the word 'awesome'.\r\n\r\nExample:\r\n\r\nInput = 'Sheldon, Penny, Leonard and Raj are great and great and great and great receptively. Wolowitz is just a great jerk';\r\n\r\nOutput = 'Sheldon, Penny, Leonard and Raj are great and awesome and great and awesome receptively. Wolowitz is just a great jerk';","description_html":"\u003cp\u003eDerived from problem 2440.\u003c/p\u003e\u003cp\u003eA string containing several sentences are given as input. If any sentence contains the word 'great' more than twice, replace every second 'great' of that sentence with the word 'awesome'.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003eInput = 'Sheldon, Penny, Leonard and Raj are great and great and great and great receptively. Wolowitz is just a great jerk';\u003c/p\u003e\u003cp\u003eOutput = 'Sheldon, Penny, Leonard and Raj are great and awesome and great and awesome receptively. Wolowitz is just a great jerk';\u003c/p\u003e","function_template":"function y = stringGreat(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx =  'Sheldon, Penny, Leonard and Raj are great and great and great and great receptively. Wolowitz is just a great jerk';\r\ny_correct =  'Sheldon, Penny, Leonard and Raj are great and awesome and great and awesome receptively. Wolowitz is just a great jerk';\r\nassert(isequal(stringGreat(x),y_correct))\r\n\r\n\r\n%%\r\nx =  'great great great. great great. great'\r\ny_correct =  'great awesome great. great awesome. great'\r\nassert(isequal(stringGreat(x),y_correct))\r\n\r\n\r\n%%\r\nx =  'Greatness is great gift. Great news'\r\ny_correct =  x;\r\nassert(isequal(stringGreat(x),y_correct))\r\n\r\n\r\n%%\r\nx =  'Being great implies that you must think like other great people and that is basically done to make sure that the proverb great minds think alike is correct and that is great. Probably that is not a great example I came up with';\r\n\r\ny_correct =  'Being great implies that you must think like other awesome people and that is basically done to make sure that the proverb great minds think alike is correct and that is awesome. Probably that is not a great example I came up with';\r\n\r\nassert(isequal(stringGreat(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":7,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-08-09T19:48:47.000Z","updated_at":"2014-08-09T19:49:40.000Z","published_at":"2014-08-09T19:48:47.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eDerived from problem 2440.\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\u003eA string containing several sentences are given as input. If any sentence contains the word 'great' more than twice, replace every second 'great' of that sentence with the word 'awesome'.\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\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput = 'Sheldon, Penny, Leonard and Raj are great and great and great and great receptively. Wolowitz is just a great jerk';\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\u003eOutput = 'Sheldon, Penny, Leonard and Raj are great and awesome and great and awesome receptively. Wolowitz is just a great jerk';\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":269,"title":"Find Rotated Substring","description":"Given a string s1, find if a rotated version of s1 is present in a second string s2.\r\nFor example, rotated version of some strings are:\r\n\"matlabcentral\" =\u003e \"atlabcentralm\" =\u003e .. =\u003e \"centralmatlab\" etc.\r\nSo, if\r\n    s1 = 'matlabcentral';\r\n    s2 = 'thecentralmatlab';\r\nthen the result is true.","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: 192.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 96.4333px; transform-origin: 407px 96.4333px; 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: 250px 8px; transform-origin: 250px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string s1, find if a rotated version of s1 is present in a second string s2.\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: 155px 8px; transform-origin: 155px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, rotated version of some strings are:\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: 196px 8px; transform-origin: 196px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\"matlabcentral\" =\u0026gt; \"atlabcentralm\" =\u0026gt; .. =\u0026gt; \"centralmatlab\" etc.\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: 16px 8px; transform-origin: 16px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSo, if\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40.8667px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 20.4333px; transform-origin: 404px 20.4333px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 36px 8.5px; transform-origin: 36px 8.5px; \"\u003e    s1 = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 60px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 60px 8.5px; \"\u003e'matlabcentral'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 112px 8.5px; tab-size: 4; transform-origin: 112px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 36px 8.5px; transform-origin: 36px 8.5px; \"\u003e    s2 = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 72px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 72px 8.5px; \"\u003e'thecentralmatlab'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; 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: 69px 8px; transform-origin: 69px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ethen the result is true.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = isRotatedStrPresent(s1,s2)\r\n  y = s1 == s2;\r\nend","test_suite":"%%\r\ns1 = 'matlabcentral';\r\ns2 = 'thecentralmatlab';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'altabcentralm';\r\ns2 = 'thecentralmatlab';\r\ny_correct = false;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'cooldrinks';\r\ns2 = 'somecoolerdrinks';\r\ny_correct = false;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'controlsystem';\r\ns2 = 'asystemcontrol';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'controlsystem';\r\ns2 = 'contorlsystem';\r\ny_correct = false;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'codyiscool';\r\ns2 = 'coolcodyis';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'abc';\r\ns2 = 'xyz';\r\ny_correct = false;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'Elements';\r\ns2 = 'Elements';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'quickbrownfoxjumpsoverlazydog';\r\ns2 = 'jumpsoverlazydogquickbrownfoxdoes';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":264,"edited_by":223089,"edited_at":"2023-05-19T07:53:48.000Z","deleted_by":null,"deleted_at":null,"solvers_count":242,"test_suite_updated_at":"2023-05-19T07:53:48.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-02-06T13:56:24.000Z","updated_at":"2026-03-12T20:46:43.000Z","published_at":"2012-02-06T14:50:07.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eGiven a string s1, find if a rotated version of s1 is present in a second string s2.\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\u003eFor example, rotated version of some strings are:\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\u003e\\\"matlabcentral\\\" =\u0026gt; \\\"atlabcentralm\\\" =\u0026gt; .. =\u0026gt; \\\"centralmatlab\\\" etc.\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\u003eSo, if\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[    s1 = 'matlabcentral';\\n    s2 = 'thecentralmatlab';]]\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\u003ethen the result is true.\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":42370,"title":"The Python Challenge, Level 1: Decode strings","description":"This problem is based on \u003chttp://www.pythonchallenge.com/pc/def/map.html Level 1 of The Python Challenge\u003e, which is just a series of puzzles created by Nadav Samet to help folks have fun while learning the Python programming language. Obviously, this Cody problem is for MATLAB, but feel free to think about how you might solve the problem in other languages!\r\n\r\nYour task is to decode an input string using the following hints:\r\n\r\n* K --\u003e M\r\n* O --\u003e Q\r\n* E --\u003e G","description_html":"\u003cp\u003eThis problem is based on \u003ca href = \"http://www.pythonchallenge.com/pc/def/map.html\"\u003eLevel 1 of The Python Challenge\u003c/a\u003e, which is just a series of puzzles created by Nadav Samet to help folks have fun while learning the Python programming language. Obviously, this Cody problem is for MATLAB, but feel free to think about how you might solve the problem in other languages!\u003c/p\u003e\u003cp\u003eYour task is to decode an input string using the following hints:\u003c/p\u003e\u003cul\u003e\u003cli\u003eK --\u0026gt; M\u003c/li\u003e\u003cli\u003eO --\u0026gt; Q\u003c/li\u003e\u003cli\u003eE --\u0026gt; G\u003c/li\u003e\u003c/ul\u003e","function_template":"function s = strdecode(str)\r\n  s = str;\r\nend","test_suite":"%%\r\nstr = 'G fmnc wms bgbl''r rpylqjyrc gr zw fylb. Rfyr''q ufyr amknsrcpq ypc dmp. Bmgle gr zw fylb gq glcddgagclr ylb rfyr''q ufw rfgq rcvr gq qm jmle. Sqgle pcecvn gq pcamkkclbcb.';\r\ns_correct = 'I hope you didn''t translate it by hand. That''s what computers are for. Doing it by hand is inefficient and that''s why this text is so long. Using regexp is recommended.';\r\nassert(isequal(strdecode(str),s_correct))\r\n\r\n%%\r\nstr = 'KYRJYZ gq yucqmkc!';\r\ns_correct = 'MATLAB is awesome!';\r\nassert(isequal(strdecode(str),s_correct))\r\n\r\n%%\r\nstr = 'dmm zyp zyx osv';\r\ns_correct = 'foo bar baz qux';\r\nassert(isequal(strdecode(str),s_correct))\r\n\r\n%%\r\np = ' .?!'';:';\r\nfor ii=1:100\r\n  str = '';\r\n  for jj=1:100\r\n    r = rand;\r\n    if r\u003c0.4\r\n      str(jj) = randi([65 90]);\r\n    elseif r\u003c0.8\r\n      str(jj) = randi([97 122]);\r\n    else\r\n      str(jj) = p(randi(7));\r\n    end\r\n  end\r\n  s_correct = regexprep(strdecode(str),'([C-Zc-z])*([ABab])*','${char($1-2)}${char($2+24)}');\r\nassert(isequal(str,s_correct))\r\nend\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":4793,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":30,"test_suite_updated_at":"2015-06-13T04:32:14.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2015-06-13T03:57:22.000Z","updated_at":"2025-12-29T15:05:02.000Z","published_at":"2015-06-13T04:13:53.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\u003eThis problem is based on\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://www.pythonchallenge.com/pc/def/map.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLevel 1 of The Python Challenge\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, which is just a series of puzzles created by Nadav Samet to help folks have fun while learning the Python programming language. Obviously, this Cody problem is for MATLAB, but feel free to think about how you might solve the problem in other languages!\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\u003eYour task is to decode an input string using the following hints:\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\u003eK --\u0026gt; M\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\u003eO --\u0026gt; Q\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\u003eE --\u0026gt; G\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":530,"title":"convert?","description":"* Given a string containing a number followed by pounds or kgs, for example:\r\n* 'Billy lost 22 pounds in four weeks.'\r\n* 'Maria gained 10 kgs in 18 months.'\r\n* If the unit was pounds, that amount should be converted to nearest rounded kgs:\r\n* 'Billy lost 10 kgs in four weeks.'\r\n* If the unit was kgs, that amount should be converted to nearest rounded pounds:\r\n* 'Maria gained 22 pounds in 18 months.'","description_html":"\u003cul\u003e\u003cli\u003eGiven a string containing a number followed by pounds or kgs, for example:\u003c/li\u003e\u003cli\u003e'Billy lost 22 pounds in four weeks.'\u003c/li\u003e\u003cli\u003e'Maria gained 10 kgs in 18 months.'\u003c/li\u003e\u003cli\u003eIf the unit was pounds, that amount should be converted to nearest rounded kgs:\u003c/li\u003e\u003cli\u003e'Billy lost 10 kgs in four weeks.'\u003c/li\u003e\u003cli\u003eIf the unit was kgs, that amount should be converted to nearest rounded pounds:\u003c/li\u003e\u003cli\u003e'Maria gained 22 pounds in 18 months.'\u003c/li\u003e\u003c/ul\u003e","function_template":"function  converted = convert(this)\r\n  converted = 'Billy lost 10 kgs in four weeks.';\r\nend","test_suite":"%%\r\nassert(isequal(convert('Billy lost 22 pounds in four weeks.'),'Billy lost 10 kgs in four weeks.'))\r\n%%\r\nassert(isequal(convert('Maria gained 10 kgs in four months.'),'Maria gained 22 pounds in four months.'))\r\n%%\r\nassert(isequal(convert('Billy lost 44 pounds in 44 weeks.'),'Billy lost 20 kgs in 44 weeks.'))\r\n%%\r\nassert(isequal(convert('Maria gained 20 kgs in 20 months.'),'Maria gained 44 pounds in 20 months.'))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":43,"test_suite_updated_at":"2012-03-26T07:11:46.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-26T07:07:32.000Z","updated_at":"2025-08-12T11:38:48.000Z","published_at":"2012-03-26T07:07:32.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\u003eGiven a string containing a number followed by pounds or kgs, for example:\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\u003e'Billy lost 22 pounds in four weeks.'\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\u003e'Maria gained 10 kgs in 18 months.'\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\u003eIf the unit was pounds, that amount should be converted to nearest rounded kgs:\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\u003e'Billy lost 10 kgs in four weeks.'\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\u003eIf the unit was kgs, that amount should be converted to nearest rounded pounds:\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\u003e'Maria gained 22 pounds in 18 months.'\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":43658,"title":"When Was That Goal Scored?","description":"We want to find out when the goals were scored in a particular soccer game. For each game, we are given a \"Goal Event Data\" XML string from a soccer database. Your job is to pick out the \"Elapsed Time\" number for each goal. Return the numbers for each goal as a column vector of double precision numbers.\r\n\r\nThis translates to finding the number between the \"\u003celapsed\u003e\" tags.\r\n\r\n*Example*\r\n\r\nGiven this input\r\n\r\n ged = '\u003cgoal\u003e\u003cvalue\u003e\u003celapsed\u003e22\u003c/elapsed\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003c/value\u003e\u003c/goal\u003e'\r\n\r\nyou should return the number 22.\r\n\r\nNote that you must return the number 22 and not the string.\r\n\r\n*Feature Tip* \r\n\r\n\u003chttps://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026startrelease=R2016b\u0026endrelease=R2016b\u0026groupby=release\u0026sortby=descending R2016b\u003e introduces string arrays and text manipulation functions which can help. To learn more see \u003chttps://www.mathworks.com/help/matlab/characters-and-strings.html MATLAB Characters and Strings\u003e.","description_html":"\u003cp\u003eWe want to find out when the goals were scored in a particular soccer game. For each game, we are given a \"Goal Event Data\" XML string from a soccer database. Your job is to pick out the \"Elapsed Time\" number for each goal. Return the numbers for each goal as a column vector of double precision numbers.\u003c/p\u003e\u003cp\u003eThis translates to finding the number between the \"\u0026lt;elapsed\u0026gt;\" tags.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cp\u003eGiven this input\u003c/p\u003e\u003cpre\u003e ged = '\u0026lt;goal\u0026gt;\u0026lt;value\u0026gt;\u0026lt;elapsed\u0026gt;22\u0026lt;/elapsed\u0026gt;\u0026lt;subtype\u0026gt;header\u0026lt;/subtype\u0026gt;\u0026lt;/value\u0026gt;\u0026lt;/goal\u0026gt;'\u003c/pre\u003e\u003cp\u003eyou should return the number 22.\u003c/p\u003e\u003cp\u003eNote that you must return the number 22 and not the string.\u003c/p\u003e\u003cp\u003e\u003cb\u003eFeature Tip\u003c/b\u003e\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026startrelease=R2016b\u0026endrelease=R2016b\u0026groupby=release\u0026sortby=descending\"\u003eR2016b\u003c/a\u003e introduces string arrays and text manipulation functions which can help. To learn more see \u003ca href = \"https://www.mathworks.com/help/matlab/characters-and-strings.html\"\u003eMATLAB Characters and Strings\u003c/a\u003e.\u003c/p\u003e","function_template":"function elapsed = getElapsedTime(ged)\r\n    elapsed = 0;\r\nend\r\n","test_suite":"%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003celapsed\u003e47\u003c/elapsed\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [47];\r\nassert(isequal(elapsed,elapsed_correct))\r\n\r\n%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e406\u003c/event_incident_typefk\u003e\u003celapsed\u003e22\u003c/elapsed\u003e\u003cplayer2\u003e38807\u003c/player2\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003cplayer1\u003e37799\u003c/player1\u003e\u003csortorder\u003e5\u003c/sortorder\u003e\u003cteam\u003e10261\u003c/team\u003e\u003cid\u003e378998\u003c/id\u003e\u003cn\u003e295\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e393\u003c/event_incident_typefk\u003e\u003celapsed\u003e24\u003c/elapsed\u003e\u003cplayer2\u003e24154\u003c/player2\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cplayer1\u003e24148\u003c/player1\u003e\u003csortorder\u003e4\u003c/sortorder\u003e\u003cteam\u003e10260\u003c/team\u003e\u003cid\u003e379019\u003c/id\u003e\u003cn\u003e298\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [22;24];\r\nassert(isequal(elapsed,elapsed_correct))\r\n\r\n%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e406\u003c/event_incident_typefk\u003e\u003celapsed\u003e73\u003c/elapsed\u003e\u003cplayer2\u003e25668\u003c/player2\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003cplayer1\u003e38755\u003c/player1\u003e\u003csortorder\u003e2\u003c/sortorder\u003e\u003cteam\u003e10194\u003c/team\u003e\u003cid\u003e465096\u003c/id\u003e\u003cn\u003e321\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [73];\r\nassert(isequal(elapsed,elapsed_correct))\r\n\r\n%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e393\u003c/event_incident_typefk\u003e\u003celapsed\u003e3\u003c/elapsed\u003e\u003cplayer2\u003e24635\u003c/player2\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cplayer1\u003e37139\u003c/player1\u003e\u003csortorder\u003e3\u003c/sortorder\u003e\u003cteam\u003e8650\u003c/team\u003e\u003cid\u003e468555\u003c/id\u003e\u003cn\u003e239\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003eo\u003c/comment\u003e\u003cstats\u003e\u003cowngoals\u003e1\u003c/owngoals\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e115\u003c/event_incident_typefk\u003e\u003celapsed\u003e69\u003c/elapsed\u003e\u003cplayer1\u003e30617\u003c/player1\u003e\u003csortorder\u003e3\u003c/sortorder\u003e\u003cteam\u003e8650\u003c/team\u003e\u003cid\u003e468934\u003c/id\u003e\u003cn\u003e304\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003eo\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed_plus\u003e1\u003c/elapsed_plus\u003e\u003cevent_incident_typefk\u003e393\u003c/event_incident_typefk\u003e\u003celapsed\u003e90\u003c/elapsed\u003e\u003cplayer2\u003e23949\u003c/player2\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cplayer1\u003e40755\u003c/player1\u003e\u003csortorder\u003e2\u003c/sortorder\u003e\u003cteam\u003e8586\u003c/team\u003e\u003cid\u003e469035\u003c/id\u003e\u003cn\u003e328\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [3; 69; 90];\r\nassert(isequal(elapsed,elapsed_correct))\r\n\r\n%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e11\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8472\u003c/team\u003e\u003cid\u003e507018\u003c/id\u003e\u003cn\u003e250\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e18\u003c/elapsed\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003cteam\u003e8559\u003c/team\u003e\u003cid\u003e507106\u003c/id\u003e\u003cn\u003e255\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e21\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8559\u003c/team\u003e\u003cid\u003e507142\u003c/id\u003e\u003cn\u003e259\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003edg\u003c/comment\u003e\u003celapsed\u003e30\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8472\u003c/team\u003e\u003cid\u003e507259\u003c/id\u003e\u003cn\u003e148\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003edg\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e39\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8559\u003c/team\u003e\u003cid\u003e507390\u003c/id\u003e\u003cn\u003e278\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e55\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8559\u003c/team\u003e\u003cid\u003e507734\u003c/id\u003e\u003cn\u003e295\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [11; 18; 21; 30; 39; 55];\r\nassert(isequal(elapsed,elapsed_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":124,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":16,"created_at":"2016-11-17T17:32:24.000Z","updated_at":"2026-03-24T21:01:26.000Z","published_at":"2016-11-17T17:46:42.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\u003eWe want to find out when the goals were scored in a particular soccer game. For each game, we are given a \\\"Goal Event Data\\\" XML string from a soccer database. Your job is to pick out the \\\"Elapsed Time\\\" number for each goal. Return the numbers for each goal as a column vector of double precision numbers.\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\u003eThis translates to finding the number between the \\\"\u0026lt;elapsed\u0026gt;\\\" tags.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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\u003eGiven this input\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[ ged = '\u003cgoal\u003e\u003cvalue\u003e\u003celapsed\u003e22\u003c/elapsed\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003c/value\u003e\u003c/goal\u003e']]\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\u003eyou should return the number 22.\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\u003eNote that you must return the number 22 and not the string.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFeature Tip\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:hyperlink w:docLocation=\\\"https://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026amp;startrelease=R2016b\u0026amp;endrelease=R2016b\u0026amp;groupby=release\u0026amp;sortby=descending\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eR2016b\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e introduces string arrays and text manipulation functions which can help. To learn more see\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=\\\"https://www.mathworks.com/help/matlab/characters-and-strings.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMATLAB Characters and Strings\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":2368,"title":"I want eval","description":"A valid MATLAB statement containing a definition of a vector is passed as a string S. Determine the length of the vector.\r\n\r\nInput: S='vec=1:10;';\r\nOutput=10\r\n\r\nExplanation: if you execute eval(S), a vector vec of length 10 will be generated.\r\nSimilarly,\r\n\r\nInput: S='a=[1 2 3 4 5];'\r\nOutput=5\r\n\r\nInput: S='a=ones(1,10);';\r\nOutput=10\r\n\r\n\r\nInput: S='a=[];';\r\nOutput=0;","description_html":"\u003cp\u003eA valid MATLAB statement containing a definition of a vector is passed as a string S. Determine the length of the vector.\u003c/p\u003e\u003cp\u003eInput: S='vec=1:10;';\r\nOutput=10\u003c/p\u003e\u003cp\u003eExplanation: if you execute eval(S), a vector vec of length 10 will be generated.\r\nSimilarly,\u003c/p\u003e\u003cp\u003eInput: S='a=[1 2 3 4 5];'\r\nOutput=5\u003c/p\u003e\u003cp\u003eInput: S='a=ones(1,10);';\r\nOutput=10\u003c/p\u003e\u003cp\u003eInput: S='a=[];';\r\nOutput=0;\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'a=[1 2 3 4 5];';\r\ny_correct = 5;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=ones(1,10);';\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x),y_correct));\r\n\r\n%%\r\nx = 'a=zeros(0,0);';\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=1:10';\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=1:2:10;';\r\ny_correct = 5;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=[];';\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=ones(10,1);';\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x),y_correct));","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2014-06-17T21:11:05.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2014-06-17T20:57:22.000Z","updated_at":"2014-06-17T21:11:05.000Z","published_at":"2014-06-17T20:58:00.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eA valid MATLAB statement containing a definition of a vector is passed as a string S. Determine the length of the vector.\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\u003eInput: S='vec=1:10;'; Output=10\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\u003eExplanation: if you execute eval(S), a vector vec of length 10 will be generated. Similarly,\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\u003eInput: S='a=[1 2 3 4 5];' Output=5\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\u003eInput: S='a=ones(1,10);'; Output=10\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\u003eInput: S='a=[];'; Output=0;\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":1376,"title":"Find names/words that start and end with the same letter.","description":"Find names/words (from a string) that start and end with the same letter.\r\n\r\n* Case-insensitive.\r\n* If a name/word is not at the end of the string, it can be followed by a white-space or a comma.\r\n* Names/words contain only letters or dashes.\r\n* Underscores are *NOT* considered as letters. Words separated by underscores count as distinct words, e.g. in |'NAN_CONST'| the |'NAN'| is matched.\r\n* Words are at least two letters long, so e.g. |'a'| is not matched.\r\n\r\nExample:\r\n\r\n in  = 'Cedric loves regular expressions'\r\n out = {'Cedric', 'regular'}\r\n\r\n","description_html":"\u003cp\u003eFind names/words (from a string) that start and end with the same letter.\u003c/p\u003e\u003cul\u003e\u003cli\u003eCase-insensitive.\u003c/li\u003e\u003cli\u003eIf a name/word is not at the end of the string, it can be followed by a white-space or a comma.\u003c/li\u003e\u003cli\u003eNames/words contain only letters or dashes.\u003c/li\u003e\u003cli\u003eUnderscores are \u003cb\u003eNOT\u003c/b\u003e considered as letters. Words separated by underscores count as distinct words, e.g. in \u003ctt\u003e'NAN_CONST'\u003c/tt\u003e the \u003ctt\u003e'NAN'\u003c/tt\u003e is matched.\u003c/li\u003e\u003cli\u003eWords are at least two letters long, so e.g. \u003ctt\u003e'a'\u003c/tt\u003e is not matched.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e in  = 'Cedric loves regular expressions'\r\n out = {'Cedric', 'regular'}\u003c/pre\u003e","function_template":"function output = getWordsSameStartEnd( inStr )\r\n  output = {inStr} ;\r\nend","test_suite":"%%\r\ninStr = 'Cedric loves regular expressions' ;\r\noutput_correct = {'Cedric', 'regular'} ;\r\nassert(isequal(getWordsSameStartEnd(inStr),output_correct))\r\n\r\n%%\r\ninStr = 'Single neuron Cedric, Anna-Maria, Andrei, a koala' ;\r\noutput_correct = {'neuron', 'Cedric', 'Anna-Maria'} ;\r\nassert(isequal(getWordsSameStartEnd(inStr),output_correct))\r\n\r\n%%\r\ninStr = '__dEdiCaTeD__, REGULAR_EXPRESSION.. Rotor-1 and abracadabra' ;\r\noutput_correct = { 'dEdiCaTeD', 'REGULAR', 'abracadabra'} ;\r\nassert(isequal(getWordsSameStartEnd(inStr),output_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":9862,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-23T02:12:12.000Z","updated_at":"2025-12-08T13:43:32.000Z","published_at":"2013-03-23T03:05:57.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\u003eFind names/words (from a string) that start and end with the same letter.\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\u003eCase-insensitive.\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\u003eIf a name/word is not at the end of the string, it can be followed by a white-space or a comma.\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\u003eNames/words contain only letters or dashes.\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\u003eUnderscores are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNOT\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e considered as letters. Words separated by underscores count as distinct words, e.g. in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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'NAN_CONST'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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'NAN'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is matched.\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\u003eWords are at least two letters long, so e.g.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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'a'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is not matched.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ in  = 'Cedric loves regular expressions'\\n out = {'Cedric', 'regular'}]]\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":35,"title":"Quote Doubler","description":"Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote character. \n \nIf there are n such occurrences in s1, then s2 will be n characters longer than s1.\n","description_html":"\u003cp\u003eGiven a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote character.\u003c/p\u003e\u003cp\u003eIf there are n such occurrences in s1, then s2 will be n characters longer than s1.\u003c/p\u003e","function_template":"function s2 = quote_doubler(s1)\n  s2 = s1\nend","test_suite":"%%\ns1 = 'He said ''Look over there!''';\ns2_correct = 'He said ''''Look over there!''''';\nassert(isequal(quote_doubler(s1),s2_correct))\n\n%%\ns1 = '''';\ns2_correct = '''''';\nassert(isequal(quote_doubler(s1),s2_correct))","published":true,"deleted":false,"likes_count":16,"comments_count":9,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3778,"test_suite_updated_at":"2012-01-18T01:00:21.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:21.000Z","updated_at":"2026-04-03T07:24:29.000Z","published_at":"2012-01-18T01:00:21.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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 s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote character.\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\u003eIf there are n such occurrences in s1, then s2 will be n characters longer than s1.\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":823,"title":"Find similar/related functions","description":"The help function can be useful for getting quick assistance on a particular function. For most built-in MATLAB functions, a portion of the help text lists similar or related functions (\"See also ...\").\r\nGiven a function name (string), return a cell array of the \"See also\" functions provided in the help text. If the input is not a real function or if no similar/related functions exist, return an empty cell array. The output should be all lowercase and in the order shown in the help text.\r\nExamples\r\nseeAlso('sum') = {'prod','cumsum','diff','accumarray','isfloat'}\r\n\r\nseeAlso('fake') = {};","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: 215.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 107.65px; transform-origin: 407px 107.65px; vertical-align: baseline; \"\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: 12.5px 8px; transform-origin: 12.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \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: 13.5px 8px; transform-origin: 13.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ehelp\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: 352.5px 8px; transform-origin: 352.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e function can be useful for getting quick assistance on a particular function. For most built-in MATLAB functions, a portion of the help text lists similar or related functions (\"See also ...\").\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: 382px 8px; transform-origin: 382px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a function name (string), return a cell array of the \"See also\" functions provided in the help text. If the input is not a real function or if no similar/related functions exist, return an empty cell array. The output should be all lowercase and in the order shown in the help text.\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: 33.5px 8px; transform-origin: 33.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExamples\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 61.3px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 30.65px; transform-origin: 404px 30.65px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 256px 8.5px; tab-size: 4; transform-origin: 256px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003eseeAlso(\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e'sum'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e) = {\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e'prod'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 32px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 32px 8.5px; \"\u003e'cumsum'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e'diff'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 48px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 48px 8.5px; \"\u003e'accumarray'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 36px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 36px 8.5px; \"\u003e'isfloat'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e}\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; tab-size: 4; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 84px 8.5px; tab-size: 4; transform-origin: 84px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003eseeAlso(\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e'fake'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 28px 8.5px; transform-origin: 28px 8.5px; \"\u003e) = {};\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function sfcn = seeAlso(fcn)\r\n  sfcn = {};\r\nend","test_suite":"%%\r\nfcn = 'help';\r\nsfcn = {'doc','docsearch','matlabpath','which'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'regexp';\r\nsfcn = {'regexpi','regexprep','regexptranslate','strcmp','strfind', 'pattern'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'why';\r\nsfcn = {};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'who';\r\nsfcn = {'whos','clear','clearvars','save','load'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'which';\r\nsfcn = {'dir','help','who','what','exist','lookfor','fileparts' ,'mfilename' ,'path' ,'type'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'what';\r\nsfcn = {'dir','who','which','lookfor'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'bsxfun';\r\nsfcn = {'repmat','arrayfun'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'mat2cell';\r\nsfcn = {'cell2mat','num2cell'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'cell2mat';\r\nsfcn = {'mat2cell','num2cell'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'hankel';\r\nsfcn = {'toeplitz'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'uisetcolor';\r\nsfcn = {'inspect','propedit','uisetfont'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'matlabiscool';\r\nsfcn = {};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'crazy';\r\nsfcn = {};\r\nassert(isequal(seeAlso(fcn),sfcn))","published":true,"deleted":false,"likes_count":0,"comments_count":9,"created_by":4793,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":"2022-03-08T17:07:58.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-07-10T21:28:00.000Z","updated_at":"2022-08-22T12:49:41.000Z","published_at":"2012-07-10T21:28:00.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eThe\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ehelp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e function can be useful for getting quick assistance on a particular function. For most built-in MATLAB functions, a portion of the help text lists similar or related functions (\\\"See also ...\\\").\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\u003eGiven a function name (string), return a cell array of the \\\"See also\\\" functions provided in the help text. If the input is not a real function or if no similar/related functions exist, return an empty cell array. The output should be all lowercase and in the order shown in the help 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\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[seeAlso('sum') = {'prod','cumsum','diff','accumarray','isfloat'}\\n\\nseeAlso('fake') = {};]]\u003e\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":1915,"title":"GJam 2013 Veterans: Baby Height Prediction","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2334486/dashboard#s=p1 GJam 2013 Veterans Baby Height\u003e. Only the first 82 of 5958 test cases are evaluated.\r\n\r\nThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex.  Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\" while a girl is -5\".  The range is +/- 4\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\r\n\r\n\r\n*Input:* str , String of Sex, Mom and Dad Height x'y\"\r\n\r\n*Output:* H , string of Predicted Height Range\r\n\r\n*Examples:* [str] [H]\r\n\r\n  B 5'11\" 6'2\"  spawns 5'11\" to 6'7\"\r\n  G 5'11\" 6'2\" spawns 5'6\" to 6'2\"\r\n  B 3'4\" 3'4\" spawns 3'3\" to 3'10\"\r\n  \r\n\r\n*Commentary:*\r\n\r\n  1) Provide input like fgetl per test case\r\n  2) 15 of 32 entrants completed this Challenge\r\n  3) This is a test of regexp and sprintf formatting (or just regexprep)","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2334486/dashboard#s=p1\"\u003eGJam 2013 Veterans Baby Height\u003c/a\u003e. Only the first 82 of 5958 test cases are evaluated.\u003c/p\u003e\u003cp\u003eThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex.  Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\" while a girl is -5\".  The range is +/- 4\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e str , String of Sex, Mom and Dad Height x'y\"\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e H , string of Predicted Height Range\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [str] [H]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eB 5'11\" 6'2\"  spawns 5'11\" to 6'7\"\r\nG 5'11\" 6'2\" spawns 5'6\" to 6'2\"\r\nB 3'4\" 3'4\" spawns 3'3\" to 3'10\"\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eCommentary:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) Provide input like fgetl per test case\r\n2) 15 of 32 entrants completed this Challenge\r\n3) This is a test of regexp and sprintf formatting (or just regexprep)\r\n\u003c/pre\u003e","function_template":"function [H]=BabyH_V(str)\r\n H='';\r\n v= regexp(str,'[''''\"\\s]','split');\r\nend","test_suite":"%%\r\ntic\r\nvstr='G 7''4\" 9''11\"';\r\nvexp='8''1\" to 8''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''1\" 4''10\"';\r\nvexp='5''11\" to 6''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''3\" 2''9\"';\r\nvexp='3''5\" to 4''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''10\" 4''4\"';\r\nvexp='2''7\" to 3''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''0\" 9''7\"';\r\nvexp='7''3\" to 7''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''5\" 4''8\"';\r\nvexp='3''6\" to 4''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''3\" 7''9\"';\r\nvexp='7''6\" to 8''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 8''7\" 8''0\"';\r\nvexp='8''2\" to 8''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''10\" 1''3\"';\r\nvexp='4''0\" to 4''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''9\" 1''5\"';\r\nvexp='1''7\" to 2''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''11\" 8''9\"';\r\nvexp='7''4\" to 7''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''7\" 9''3\"';\r\nvexp='6''10\" to 7''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''2\" 7''11\"';\r\nvexp='4''11\" to 5''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''0\" 3''9\"';\r\nvexp='2''10\" to 3''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''5\" 3''3\"';\r\nvexp='3''10\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''6\" 1''4\"';\r\nvexp='1''5\" to 2''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''8\" 8''7\"';\r\nvexp='8''1\" to 8''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''11\" 7''3\"';\r\nvexp='8''1\" to 8''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''0\" 1''2\"';\r\nvexp='4''7\" to 5''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''0\" 1''2\"';\r\nvexp='3''7\" to 4''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 5''6\" 5''7\"';\r\nvexp='5''5\" to 6''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''8\" 6''1\"';\r\nvexp='4''10\" to 5''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''7\" 2''3\"';\r\nvexp='2''5\" to 3''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''7\" 6''7\"';\r\nvexp='6''7\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''6\" 6''5\"';\r\nvexp='7''10\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''3\" 4''11\"';\r\nvexp='2''7\" to 3''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''0\" 5''6\"';\r\nvexp='3''3\" to 3''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''7\" 6''8\"';\r\nvexp='3''7\" to 4''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''3\" 5''11\"';\r\nvexp='4''0\" to 4''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''3\" 3''6\"';\r\nvexp='2''9\" to 3''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''10\" 1''9\"';\r\nvexp='5''8\" to 6''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''6\" 5''11\"';\r\nvexp='4''8\" to 5''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''6\" 1''2\"';\r\nvexp='3''10\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 3''7\" 9''1\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''9\" 9''11\"';\r\nvexp='7''10\" to 8''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''10\" 8''10\"';\r\nvexp='5''3\" to 5''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''11\" 7''4\"';\r\nvexp='6''7\" to 7''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''9\" 4''8\"';\r\nvexp='3''1\" to 3''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''8\" 6''3\"';\r\nvexp='7''10\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 5''6\" 8''4\"';\r\nvexp='6''10\" to 7''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''7\" 9''6\"';\r\nvexp='6''6\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''7\" 7''1\"';\r\nvexp='4''4\" to 4''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''1\" 7''10\"';\r\nvexp='5''11\" to 6''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''5\" 8''7\"';\r\nvexp='4''6\" to 5''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''0\" 1''0\"';\r\nvexp='2''0\" to 2''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''4\" 7''1\"';\r\nvexp='5''7\" to 6''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''1\" 8''1\"';\r\nvexp='5''1\" to 5''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''5\" 7''8\"';\r\nvexp='6''0\" to 6''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''7\" 8''2\"';\r\nvexp='7''4\" to 8''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''6\" 5''1\"';\r\nvexp='3''9\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''9\" 6''9\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''4\" 5''8\"';\r\nvexp='5''6\" to 6''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''4\" 2''10\"';\r\nvexp='5''1\" to 5''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''7\" 9''5\"';\r\nvexp='7''11\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''6\" 5''7\"';\r\nvexp='6''5\" to 7''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''11\" 8''10\"';\r\nvexp='7''9\" to 8''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''4\" 3''2\"';\r\nvexp='4''3\" to 4''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''3\" 8''3\"';\r\nvexp='8''3\" to 8''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''7\" 1''4\"';\r\nvexp='2''11\" to 3''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''2\" 2''4\"';\r\nvexp='4''8\" to 5''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''2\" 5''8\"';\r\nvexp='6''11\" to 7''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''4\" 5''5\"';\r\nvexp='5''9\" to 6''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''6\" 7''7\"';\r\nvexp='8''5\" to 9''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''6\" 1''2\"';\r\nvexp='2''4\" to 2''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''10\" 3''7\"';\r\nvexp='4''1\" to 4''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''10\" 2''8\"';\r\nvexp='5''3\" to 5''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 8''5\" 4''3\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''1\" 3''0\"';\r\nvexp='4''11\" to 5''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''1\" 9''3\"';\r\nvexp='4''8\" to 5''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''0\" 1''11\"';\r\nvexp='3''10\" to 4''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''6\" 9''9\"';\r\nvexp='7''0\" to 7''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''6\" 3''9\"';\r\nvexp='5''1\" to 5''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''5\" 2''7\"';\r\nvexp='4''11\" to 5''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''11\" 1''0\"';\r\nvexp='3''10\" to 4''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''3\" 3''9\"';\r\nvexp='4''6\" to 5''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''0\" 6''1\"';\r\nvexp='6''6\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''1\" 3''11\"';\r\nvexp='2''5\" to 3''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''8\" 2''7\"';\r\nvexp='3''1\" to 3''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''2\" 3''3\"';\r\nvexp='2''8\" to 3''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''5\" 6''8\"';\r\nvexp='4''0\" to 4''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''8\" 3''8\"';\r\nvexp='3''1\" to 3''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''6\" 2''9\"';\r\nvexp='4''1\" to 4''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-06T00:21:27.000Z","updated_at":"2013-10-06T02:46:32.000Z","published_at":"2013-10-06T00:35:38.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\u003eThis Challenge is derived from\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://code.google.com/codejam/contest/2334486/dashboard#s=p1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 Veterans Baby Height\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Only the first 82 of 5958 test cases are evaluated.\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 GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex. Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\\\" while a girl is -5\\\". The range is +/- 4\\\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e str , String of Sex, Mom and Dad Height x'y\\\"\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e H , string of Predicted Height Range\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [str] [H]\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[B 5'11\\\" 6'2\\\"  spawns 5'11\\\" to 6'7\\\"\\nG 5'11\\\" 6'2\\\" spawns 5'6\\\" to 6'2\\\"\\nB 3'4\\\" 3'4\\\" spawns 3'3\\\" to 3'10\\\"]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCommentary:\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[1) Provide input like fgetl per test case\\n2) 15 of 32 entrants completed this Challenge\\n3) This is a test of regexp and sprintf formatting (or just regexprep)]]\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":1937,"title":"Get input and output variable names","description":"Given a string representing a function header, return the variable names used for the inputs and outputs.\r\nFor example if input string s is 'function [A,B] = myfun(c,d,f)', the input names are {'c';'d';'f'} and the output names are {'A';'B'};","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: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 36px; 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: 330.5px 8px; transform-origin: 330.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string representing a function header, return the variable names used for the inputs and outputs.\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: 368.5px 8px; transform-origin: 368.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example if input string s is 'function [A,B] = myfun(c,d,f)', the input names are {'c';'d';'f'} and the output names are {'A';'B'};\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [inNames, outNames] = get_variable_names(s)\r\n  y = x;\r\nend","test_suite":"%%\r\ns = 'function foo()';\r\ninNames_correct = {};\r\noutNames_correct = {};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))\r\n\r\n%%\r\ns = 'function a = foo(b)';\r\ninNames_correct = {'b'};\r\noutNames_correct = {'a'};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))\r\n\r\n%%\r\ns = 'function [myOutput] = foo(b,c)';\r\ninNames_correct = {'b';'c'};\r\noutNames_correct = {'myOutput'};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))\r\n\r\n%%\r\ns = 'function [A,B] = foo(c,d,f)';\r\ninNames_correct = {'c';'d';'f'};\r\noutNames_correct = {'A';'B'};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))\r\n\r\n%%\r\ns = sprintf('function %s=...\\nmyfun %s...\\n  %s\\n% With comments[]()\\nandCode = 4*[1 3 4/(1+2)];','[how,about , several,outputs]','(and , several, inputs ,','split,over,lotsOf,lines)');\r\ninNames_correct = {'and';'several';'inputs';'split';'over';'lotsOf';'lines'};\r\noutNames_correct = {'how';'about';'several';'outputs'};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":10139,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2021-11-17T16:03:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-16T12:17:55.000Z","updated_at":"2026-03-11T11:07:43.000Z","published_at":"2013-10-16T12:25:35.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\u003eGiven a string representing a function header, return the variable names used for the inputs and outputs.\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\u003eFor example if input string s is 'function [A,B] = myfun(c,d,f)', the input names are {'c';'d';'f'} and the output names are {'A';'B'};\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":519,"title":"Pig Latin to English Translator","description":"Pig latin is a faux-language based off of English. The rules are as follows (excerpted from the \u003chttp://en.wikipedia.org/wiki/Pig_Latin Wikipedia entry for Pig Latin\u003e):\r\n\r\n1. In words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and \"ay\" is added, as in the following examples:\r\n\r\n    * happy → appy-hay\r\n    * question → estion-quay\r\n\r\n2. In words that begin with vowels, the syllable \"ay\" is simply added to the end of the word.\r\n\r\n    * another → another-ay\r\n    * about → about-ay\r\n\r\nA hyphen is sometimes used to facilitate translation back into English. Ayspray, for instance, is ambiguous, but ay-spray means \"spray\" whereas ays-pray means \"prays.\"\r\n\r\nGiven a string in Pig Latin (may be multiple words), produce the English version.","description_html":"\u003cp\u003ePig latin is a faux-language based off of English. The rules are as follows (excerpted from the \u003ca href=\"http://en.wikipedia.org/wiki/Pig_Latin\"\u003eWikipedia entry for Pig Latin\u003c/a\u003e):\u003c/p\u003e\u003cp\u003e1. In words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and \"ay\" is added, as in the following examples:\u003c/p\u003e\u003cpre\u003e    * happy → appy-hay\r\n    * question → estion-quay\u003c/pre\u003e\u003cp\u003e2. In words that begin with vowels, the syllable \"ay\" is simply added to the end of the word.\u003c/p\u003e\u003cpre\u003e    * another → another-ay\r\n    * about → about-ay\u003c/pre\u003e\u003cp\u003eA hyphen is sometimes used to facilitate translation back into English. Ayspray, for instance, is ambiguous, but ay-spray means \"spray\" whereas ays-pray means \"prays.\"\u003c/p\u003e\u003cp\u003eGiven a string in Pig Latin (may be multiple words), produce the English version.\u003c/p\u003e","function_template":"function e = piglatin2english( p )\r\n  e = p;\r\nend","test_suite":"%%\r\nstr1 = 'estion-quay';\r\nstr2 = 'question';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'another-ay';\r\nstr2 = 'another';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'ix-nay';\r\nstr2 = 'nix';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'another-ay one-ay ites-bay e-thay ust-day';\r\nstr2 = 'another one bites the dust';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'ow-hay uch-may ood-way ould-way a-ay oodchuck-way uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way';\r\nstr2 = 'how much wood would a woodchuck chuck if a woodchuck could chuck wood';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'eter-pay iper-pay icked-pay a-ay eck-pay of-ay ickle-pay eppers-pay';\r\nstr2 = 'peter piper picked a peck of pickle peppers';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'our-fay ore-scay';\r\nstr2 = 'four score';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":166,"test_suite_updated_at":"2016-12-12T17:58:46.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-03-22T15:04:46.000Z","updated_at":"2026-03-15T01:34:17.000Z","published_at":"2012-03-22T15:05:17.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\u003ePig latin is a faux-language based off of English. The rules are as follows (excerpted from the\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/Pig_Latin\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eWikipedia entry for Pig Latin\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1. In words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and \\\"ay\\\" is added, as in the following examples:\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[    * happy → appy-hay\\n    * question → estion-quay]]\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\u003e2. In words that begin with vowels, the syllable \\\"ay\\\" is simply added to the end of the word.\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[    * another → another-ay\\n    * about → about-ay]]\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\u003eA hyphen is sometimes used to facilitate translation back into English. Ayspray, for instance, is ambiguous, but ay-spray means \\\"spray\\\" whereas ays-pray means \\\"prays.\\\"\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\u003eGiven a string in Pig Latin (may be multiple words), produce the English version.\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":22,"title":"Remove the vowels","description":"Remove all the vowels in the given phrase.\n\nExample:\n\n Input  s1 = 'Jack and Jill went up the hill'\n Output s2 is 'Jck nd Jll wnt p th hll'\n","description_html":"\u003cp\u003eRemove all the vowels in the given phrase.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input  s1 = 'Jack and Jill went up the hill'\n Output s2 is 'Jck nd Jll wnt p th hll'\u003c/pre\u003e","function_template":"function s2 = refcn(s1)\n  s2 = s1;\nend","test_suite":"%%\ns1 = 'Jack and Jill went up the hill'; \ns2 = 'Jck nd Jll wnt p th hll';\nassert(isequal(s2,refcn(s1)))\n\n%%\ns1 = 'I don''t want to work. I just want to bang on the drum all day.'; \ns2 = ' dn''t wnt t wrk.  jst wnt t bng n th drm ll dy.'; \nassert(isequal(s2,refcn(s1)))","published":true,"deleted":false,"likes_count":30,"comments_count":13,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6440,"test_suite_updated_at":"2012-01-18T01:00:20.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:20.000Z","updated_at":"2026-03-23T05:31:20.000Z","published_at":"2012-01-18T01:00:20.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\u003eRemove all the vowels in the given phrase.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input  s1 = 'Jack and Jill went up the hill'\\n Output s2 is 'Jck nd Jll wnt p th hll']]\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":66,"title":"Find the two-word state names","description":"Given a list of states, remove all the states that have two-word names.\r\n\r\nIf\r\n\r\n s1 = 'Alabama Montana North Carolina Vermont Nevada'; \r\n\r\nthen\r\n\r\n s2 = 'Alabama Montana  Vermont Nevada';","description_html":"\u003cp\u003eGiven a list of states, remove all the states that have two-word names.\u003c/p\u003e\u003cp\u003eIf\u003c/p\u003e\u003cpre\u003e s1 = 'Alabama Montana North Carolina Vermont Nevada'; \u003c/pre\u003e\u003cp\u003ethen\u003c/p\u003e\u003cpre\u003e s2 = 'Alabama Montana  Vermont Nevada';\u003c/pre\u003e","function_template":"function s2 = refcn(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada New Hampshire New Jersey New Mexico New York North Carolina North Dakota Ohio Oklahoma Oregon Pennsylvania Rhode Island South Carolina South Dakota Tennessee Texas Utah Vermont Virginia Washington West Virginia Wisconsin Wyoming';\r\n\r\ns2 = 'Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada       Ohio Oklahoma Oregon Pennsylvania    Tennessee Texas Utah Vermont Virginia Washington  Wisconsin Wyoming'; \r\n\r\nassert(isequal(s2,refcn(s1)))\r\n\r\n%%\r\ns1 = 'New York Nevada Texas Utah Vermont West Virginia Virginia';\r\n\r\ns2 = ' Nevada Texas Utah Vermont  Virginia'; \r\n\r\nassert(isequal(s2,refcn(s1)))","published":true,"deleted":false,"likes_count":6,"comments_count":16,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1220,"test_suite_updated_at":"2012-06-05T14:38:53.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:26.000Z","updated_at":"2026-02-04T16:01:58.000Z","published_at":"2012-01-18T01:00: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=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a list of states, remove all the states that have two-word names.\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\u003eIf\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[ s1 = 'Alabama Montana North Carolina Vermont Nevada';]]\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\u003ethen\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[ s2 = 'Alabama Montana  Vermont Nevada';]]\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":44231,"title":"Is it a mail?","description":"Electronic mail, or email, is a method of exchanging digital messages between people using digital devices such as computers, mobile phones and other electronics. Email first entered substantial use in the 1960s and by the mid-1970s had taken the form now recognized as email. Email operates across computer networks, which today is primarily the Internet. \r\nWrite a function witch help you to verify if a string given is a mail address or not, true if you want to say yes it's a mail, and false if not a mail address.\r\nReference","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: 165px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 82.5px; transform-origin: 407px 82.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; 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: 361.5px 8px; transform-origin: 361.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eElectronic mail, or email, is a method of exchanging digital messages between people using digital devices such as computers, mobile phones and other electronics. Email first entered substantial use in the 1960s and by the mid-1970s had taken the form now recognized as email. Email operates across computer networks, which today is primarily the Internet. \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: 383.5px 8px; transform-origin: 383.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function witch help you to verify if a string given is a mail address or not, true if you want to say yes it's a mail, and false if not a mail address.\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\u003ca target='_blank' href = \"https://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-an-email-address\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eReference\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = ismail(x)\r\n  y = true;\r\nend","test_suite":"%%\r\nx ='ilove@cody.math';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='goc3@kjkjhedfqoishdoifqjsdjvkshiufghiorhoihfoiqphsoihqohfoiqhpsoiffvhnqokshfvoiqhdshfoviqhskfhvoqisdhfvqshoifvhqosidfvioqsfdivhqsoifdvghjqsiofvqoisjoivqhsoifhvqshfvhqsfhvqklsffnvkqsjdfnvqksjfnvqklfdshvqkslvjklqskvlqjslvkqsnvqklsdfvklqsdfvjnqkldfsvkqklvjqfvklqdjf.dz';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='goc3@kjkjhedfqoishdoifqjsdjvkshiufghiorhoihfoiqphsoihqohfoiqhpsoiffvhnqokshfvoiqhdshfoviqhskfhvoqisdhfvqshoifvhqosidfvioqsfdivhqsoifdvghjqsiofvqoisjoivqhsoifhvqshfvhqsfhvqklsffnvkqsjdfnvqksjfnvqklfdshvqksl@vjklqskvlqjslvkqsnvqklsdfvklqsdfvjnqkld.dz';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx=1223;\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='123@mathworks.com';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='james@mathworks@com';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='msila@tarmount.com';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='elon.musk@twitter.com';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='ssssss@m@thworks.xyz';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='mes@rym.co.uk';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='abc?!@bro.tr..dz';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='abcd@?ml?club';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='abcd@3.141592653589793238462643383279502884197169399375105820974944592.com';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='info@thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='info@thelongestdomainnameintheworld andthensomeandthensomemoreandmore.com';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":8,"created_by":37163,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2022-02-16T07:28:42.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-06-02T17:45:40.000Z","updated_at":"2026-03-19T10:29:17.000Z","published_at":"2017-06-02T17:45:39.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\u003eElectronic mail, or email, is a method of exchanging digital messages between people using digital devices such as computers, mobile phones and other electronics. Email first entered substantial use in the 1960s and by the mid-1970s had taken the form now recognized as email. Email operates across computer networks, which today is primarily the Internet. \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 witch help you to verify if a string given is a mail address or not, true if you want to say yes it's a mail, and false if not a mail address.\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:hyperlink w:docLocation=\\\"https://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-an-email-address\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eReference\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":28,"title":"Counting Money","description":"Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99.\r\n\r\nExample:\r\n\r\n Input a = {'$12,001.87','$0.04','$12,003,887.55','$0.32'};\r\n Output b is 12015889.78","description_html":"\u003cp\u003eAdd the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input a = {'$12,001.87','$0.04','$12,003,887.55','$0.32'};\r\n Output b is 12015889.78\u003c/pre\u003e","function_template":"function b = moneySum(a)\r\n\r\n  b = 0;\r\n\r\nend","test_suite":"%%\r\na = {'$12,001.87','$0.04','$103,887.55','$0.32'};\r\nb =   115889.78;\r\nassert(abs(moneySum(a)-b) \u003c 1e-4)\r\n\r\n%%\r\na = {'$0.02'};\r\nb =   0.02;\r\nassert(abs(moneySum(a)-b) \u003c 1e-4)\r\n\r\n%%\r\na = {'$81.47','$12.69','$91,337.60'};\r\nb =    91431.76;\r\nassert(abs(moneySum(a)-b) \u003c 1e-4)","published":true,"deleted":false,"likes_count":17,"comments_count":3,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3811,"test_suite_updated_at":"2012-11-20T15:21:59.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:20.000Z","updated_at":"2026-02-28T05:02:26.000Z","published_at":"2012-01-18T01:00:20.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\u003eAdd the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input a = {'$12,001.87','$0.04','$12,003,887.55','$0.32'};\\n Output b is 12015889.78]]\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":1383,"title":"Count letters occurence in text, specific to words with a given length.","description":"Build a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\r\n\r\n* Case insensitive.\r\n* Words contain only letters a-zA-Z, but the string can contain punctuation.\r\n\r\n*Example*\r\n\r\n \u003e\u003e txt = 'Hello World, from MATLAB' ;\r\n \u003e\u003e nl  = 5 ;                              % Number of letters.\r\n \u003e\u003e nlWords_getCounts(txt, nl)\r\n ans = \r\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0\r\n\r\nhere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\r\n ","description_html":"\u003cp\u003eBuild a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\u003c/p\u003e\u003cul\u003e\u003cli\u003eCase insensitive.\u003c/li\u003e\u003cli\u003eWords contain only letters a-zA-Z, but the string can contain punctuation.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e \u003e\u003e txt = 'Hello World, from MATLAB' ;\r\n \u003e\u003e nl  = 5 ;                              % Number of letters.\r\n \u003e\u003e nlWords_getCounts(txt, nl)\r\n ans = \r\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0\u003c/pre\u003e\u003cp\u003ehere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\u003c/p\u003e","function_template":"function counts = nlWords_getCounts(txt, nl)\r\n  counts = 0 ;\r\nend","test_suite":"%%\r\ntxt = 'Hello World, from MATLAB' ;\r\nnl  = 5 ;\r\ncounts_correct = [0 0 0 1 1 0 0 1 0 0 0 3 0 0 2 0 0 1 0 0 0 0 1 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n\r\n%%\r\ntxt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.'\r\nnl  = 9 ;\r\ncounts_correct = [3 0 3 1 5 0 1 1 0 0 0 1 0 2 1 2 0 2 2 0 2 0 1 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n\r\n%%\r\ntxt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.'\r\nnl  = 10 ;\r\ncounts_correct = [6 0 6 0 3 0 0 3 0 0 0 0 0 0 0 0 0 6 3 3 0 0 0 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":9862,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":197,"test_suite_updated_at":"2013-03-25T03:27:53.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-03-25T03:08:33.000Z","updated_at":"2026-03-10T20:25:05.000Z","published_at":"2013-03-25T03:27:53.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\u003eBuild a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\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\u003eCase insensitive.\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\u003eWords contain only letters a-zA-Z, but the string can contain punctuation.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ \u003e\u003e txt = 'Hello World, from MATLAB' ;\\n \u003e\u003e nl  = 5 ;                              % Number of letters.\\n \u003e\u003e nlWords_getCounts(txt, nl)\\n ans = \\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0]]\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\u003ehere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\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":13,"title":"Remove all the consonants","description":"Remove all the consonants in the given phrase.\r\n\r\nExample:\r\n\r\n Input  s1 = 'Jack and Jill went up the hill'; \r\n Output s2 is 'a a i e u e i';","description_html":"\u003cp\u003eRemove all the consonants in the given phrase.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input  s1 = 'Jack and Jill went up the hill'; \r\n Output s2 is 'a a i e u e i';\u003c/pre\u003e","function_template":"function s2 = refcn(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'Jack and Jill went up the hill'; \r\ns2 = 'a a i e u e i';\r\nassert(isequal(s2,refcn(s1)))\r\n\r\n%%\r\ns1 = 'I don''t want to work. I just want to bang on the drum all day.'; \r\ns2 = 'I o'' a o o. I u a o a o e u a a.'; \r\nassert(isequal(s2,refcn(s1)))","published":true,"deleted":false,"likes_count":26,"comments_count":23,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4183,"test_suite_updated_at":"2012-02-03T17:52:34.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:18.000Z","updated_at":"2026-03-23T02:01:50.000Z","published_at":"2012-01-18T01:00:18.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\u003eRemove all the consonants in the given phrase.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input  s1 = 'Jack and Jill went up the hill'; \\n Output s2 is 'a a i e u e i';]]\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":80,"title":"Test for balanced parentheses","description":"Given the input inStr, give the boolean output out indicating whether all\r\nthe parentheses are balanced. \r\n \r\nExamples:\r\n\r\n* If inStr is '(()', the output is false.\r\n* If inStr is '(xyz)(ab)' the output is true.\r\n* If inStr is ')(', the output is false.\r\n \r\nThe string may include characters other than ( and ), but you should ignore them.\r\n\r\nIncidentally, this problem was inspired from the \u003chttp://rosettacode.org/wiki/Balanced_brackets Rosetta Code site\u003e. Why not create a few problems of your own by poking around \u003chttp://rosettacode.org/wiki/Category:Programming_Tasks the tasks\u003e at Rosetta Code?","description_html":"\u003cp\u003eGiven the input inStr, give the boolean output out indicating whether all\r\nthe parentheses are balanced.\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cul\u003e\u003cli\u003eIf inStr is '(()', the output is false.\u003c/li\u003e\u003cli\u003eIf inStr is '(xyz)(ab)' the output is true.\u003c/li\u003e\u003cli\u003eIf inStr is ')(', the output is false.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe string may include characters other than ( and ), but you should ignore them.\u003c/p\u003e\u003cp\u003eIncidentally, this problem was inspired from the \u003ca href=\"http://rosettacode.org/wiki/Balanced_brackets\"\u003eRosetta Code site\u003c/a\u003e. Why not create a few problems of your own by poking around \u003ca href=\"http://rosettacode.org/wiki/Category:Programming_Tasks\"\u003ethe tasks\u003c/a\u003e at Rosetta Code?\u003c/p\u003e","function_template":"function out = isBalanced(inStr)\r\n  out = false;\r\nend","test_suite":"%%\r\n\r\ninStr = '()';\r\nout_correct = true;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = ')';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = '(z*(a-(x+3))/(y))';\r\nout_correct = true;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = ')(';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = '(x)(x-y)';\r\nout_correct = true;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = ':-)';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = ')()';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = '(()';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))","published":true,"deleted":false,"likes_count":9,"comments_count":1,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1247,"test_suite_updated_at":"2013-07-10T21:27:37.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:28.000Z","updated_at":"2026-02-04T17:33:56.000Z","published_at":"2012-01-18T01:00:28.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 the input inStr, give the boolean output out indicating whether all the parentheses are balanced.\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\u003eExamples:\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\u003eIf inStr is '(()', the output is false.\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\u003eIf inStr is '(xyz)(ab)' the output is true.\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\u003eIf inStr is ')(', the output is false.\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 string may include characters other than ( and ), but you should ignore them.\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\u003eIncidentally, this problem was inspired from the\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://rosettacode.org/wiki/Balanced_brackets\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRosetta Code site\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Why not create a few problems of your own by poking around\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://rosettacode.org/wiki/Category:Programming_Tasks\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ethe tasks\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e at Rosetta Code?\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":44306,"title":"Is it really a 5?","description":"A number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \"five\" anywhere. For example:\r\n\r\n n = 5; return true since it is spelled \"five\"\r\n n = 15; return false since it is spelled \"fifteen\" and does not contain the four-letter string \"five\"\r\n\r\nThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \"five\" for this problem.\r\n\r\nSee the test suite for more examples.","description_html":"\u003cp\u003eA number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \"five\" anywhere. For example:\u003c/p\u003e\u003cpre\u003e n = 5; return true since it is spelled \"five\"\r\n n = 15; return false since it is spelled \"fifteen\" and does not contain the four-letter string \"five\"\u003c/pre\u003e\u003cp\u003eThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \"five\" for this problem.\u003c/p\u003e\u003cp\u003eSee the test suite for more examples.\u003c/p\u003e","function_template":"function tf = is_it_really_a_5(n)\r\n tf = 0;\r\nend","test_suite":"%%\r\nn = 5;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 25;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 35;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 52;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 59;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 85;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 105;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 115;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 125;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 250;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 500;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 555;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000; %5,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15000; %15,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55555; %55,555\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000; %50,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55000; %55,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50500; %50,500\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50050; %50,050\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50005; %50,005\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 500000; %500,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000000; %5,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15000000; %15,000,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50000000; %50,000,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 105000000; %105,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50050050; %50,050,050\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50000005; %50,000,005\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000015; %50,000,015\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 500000000; %500,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000000000; %5,000,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000000000; %50,000,000,000\r\nassert(isequal(is_it_really_a_5(n),0))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":316,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-08T22:07:48.000Z","updated_at":"2026-03-18T13:28:44.000Z","published_at":"2017-10-16T01:45:06.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\u003eA number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \\\"five\\\" anywhere. For example:\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[ n = 5; return true since it is spelled \\\"five\\\"\\n n = 15; return false since it is spelled \\\"fifteen\\\" and does not contain the four-letter string \\\"five\\\"]]\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\u003eThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \\\"five\\\" for this problem.\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\u003eSee the test suite for more examples.\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":920,"title":"Eliminate Polysyllabics: Long live short words!","description":"Given a string s1, return s2 in which all the words with more than one syllable have been removed.\r\n\r\nTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\r\n\r\nSo these words are polysyllabic:\r\n\r\n ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS\r\n\r\nThese words are monosyllabic:\r\n\r\n STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE\r\n\r\nHere are some examples of one-syllable words that I WON'T use because they violate my rules:\r\n\r\n ONE ICED JUICE PLEASE\r\n\r\nAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\r\n\r\nExample:\r\n\r\n Input:  'The all day meetings will continue until we learn why productivity is so low'\r\n\r\n Output: 'The all day will we learn why is so low'","description_html":"\u003cp\u003eGiven a string s1, return s2 in which all the words with more than one syllable have been removed.\u003c/p\u003e\u003cp\u003eTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\u003c/p\u003e\u003cp\u003eSo these words are polysyllabic:\u003c/p\u003e\u003cpre\u003e ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS\u003c/pre\u003e\u003cp\u003eThese words are monosyllabic:\u003c/p\u003e\u003cpre\u003e STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE\u003c/pre\u003e\u003cp\u003eHere are some examples of one-syllable words that I WON'T use because they violate my rules:\u003c/p\u003e\u003cpre\u003e ONE ICED JUICE PLEASE\u003c/pre\u003e\u003cp\u003eAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input:  'The all day meetings will continue until we learn why productivity is so low'\u003c/pre\u003e\u003cpre\u003e Output: 'The all day will we learn why is so low'\u003c/pre\u003e","function_template":"function s2 = just_short_words(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'The all day meetings will continue until we learn why productivity is so low';\r\ns2_correct = 'The all day will we learn why is so low';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'I am perpetually perplexed my big brain notwithstanding';\r\ns2_correct = 'I am my big brain';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Lazy gravy calico sky ipso facto sweet potato pie';\r\ns2_correct = 'sky sweet pie';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":150,"test_suite_updated_at":"2012-12-21T22:37:32.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2012-08-23T14:29:37.000Z","updated_at":"2026-02-02T20:02:03.000Z","published_at":"2012-12-21T19:04:46.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 s1, return s2 in which all the words with more than one syllable have been removed.\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\u003eTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\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\u003eSo these words are polysyllabic:\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[ ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS]]\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\u003eThese words are monosyllabic:\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[ STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE]]\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\u003eHere are some examples of one-syllable words that I WON'T use because they violate my rules:\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[ ONE ICED JUICE PLEASE]]\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\u003eAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input:  'The all day meetings will continue until we learn why productivity is so low'\\n\\n Output: 'The all day will we learn why is so low']]\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":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":15,"title":"Find the longest sequence of 1's in a binary sequence.","description":"Given a string such as\n\n s = '011110010000000100010111'\n\nfind the length of the longest string of consecutive 1's. In this example, the answer would be 4.\n\nExample:\n\n Input  x = '110100111'\n Output y is 3","description_html":"\u003cp\u003eGiven a string such as\u003c/p\u003e\u003cpre\u003e s = '011110010000000100010111'\u003c/pre\u003e\u003cp\u003efind the length of the longest string of consecutive 1's. In this example, the answer would be 4.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input  x = '110100111'\n Output y is 3\u003c/pre\u003e","function_template":"function y = lengthOnes(x)\n  y = x\nend","test_suite":"%%\nx = '0';\ny_correct = 0;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '1';\ny_correct = 1;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '01';\ny_correct = 1;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '10';\ny_correct = 1;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '00';\ny_correct = 0;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '11';\n y_correct = 2;\nassert(isequal(lengthOnes(x),y_correct))\n%%\nx = '1111111111';\ny_correct = 10;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '100101011111010011111';\ny_correct = 5;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '01010101010101010101010101';\ny_correct = 1;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '0101010111000101110001011100010100001110110100000000110001001000001110001000111010101001101100001111';\ny_correct = 4;\nassert(isequal(lengthOnes(x),y_correct))","published":true,"deleted":false,"likes_count":81,"comments_count":10,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6696,"test_suite_updated_at":"2012-01-18T01:00:19.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:19.000Z","updated_at":"2026-04-03T20:38:16.000Z","published_at":"2012-01-18T01:00:19.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 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[ s = '011110010000000100010111']]\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\u003efind the length of the longest string of consecutive 1's. In this example, the answer would be 4.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input  x = '110100111'\\n Output y is 3]]\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":43963,"title":"Finding operators in a MATLAB function in a string.","description":"The aim is to find if there is an operator inside a MATLAB function call in a formula. The input is a string and the output is a boolean which is true if the string contains at least one operator in a function call, and false otherwise.\r\n\r\nFor example:\r\n\r\n 'min(var1+var2,2)' =\u003e true\r\n\r\n 'min(1,2)+min(3,4)' =\u003e false\r\n\r\n 'min(min(1,2),3))' =\u003e false\r\n\r\n 'min(min(1,var1+2),3))' =\u003e true\r\n\r\n '4*var1' =\u003e false, there is no MATLAB function\r\n\r\nYou can assume that all opening brackets are closed.","description_html":"\u003cp\u003eThe aim is to find if there is an operator inside a MATLAB function call in a formula. The input is a string and the output is a boolean which is true if the string contains at least one operator in a function call, and false otherwise.\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre\u003e 'min(var1+var2,2)' =\u0026gt; true\u003c/pre\u003e\u003cpre\u003e 'min(1,2)+min(3,4)' =\u0026gt; false\u003c/pre\u003e\u003cpre\u003e 'min(min(1,2),3))' =\u0026gt; false\u003c/pre\u003e\u003cpre\u003e 'min(min(1,var1+2),3))' =\u0026gt; true\u003c/pre\u003e\u003cpre\u003e '4*var1' =\u0026gt; false, there is no MATLAB function\u003c/pre\u003e\u003cp\u003eYou can assume that all opening brackets are closed.\u003c/p\u003e","function_template":"function y = FindingOperators( x )\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'min(var1+var2,2)';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(1,2)+min(3,4)';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(min(1,2),3))';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(min(1,var1+2),3))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n\r\n%%\r\n\r\nx = '4*var1';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4*(var1+2)';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n\r\n%%\r\n\r\nx = 'max(min(1,var1-2),3))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+abs(2)';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+abs(2/var1)';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+abs(2+min(1+5,1))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+max(2,min(1+5,1))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+max((2,min(1+5,1)))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(2-1,1)+abs(-5)';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(var1,1)+abs(-5)';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(min(var1,var2),1+3)';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":55046,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-22T09:44:46.000Z","updated_at":"2016-12-22T15:57:10.000Z","published_at":"2016-12-22T09:44:46.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\u003eThe aim is to find if there is an operator inside a MATLAB function call in a formula. The input is a string and the output is a boolean which is true if the string contains at least one operator in a function call, and false otherwise.\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\u003eFor example:\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[ 'min(var1+var2,2)' =\u003e true\\n\\n 'min(1,2)+min(3,4)' =\u003e false\\n\\n 'min(min(1,2),3))' =\u003e false\\n\\n 'min(min(1,var1+2),3))' =\u003e true\\n\\n '4*var1' =\u003e false, there is no MATLAB function]]\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\u003eYou can assume that all opening brackets are closed.\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":45434,"title":"Weighted Names","description":"A cell is given which contains several names. You've to return those names sorted by their weight. \r\n\r\nWeight is to be calculated by the following rules - \r\n \r\n 1.each letter's weight is the ASCII value. \r\n\r\n 2.the 1st name weights 2 times its original value but if the name contains any middle name \r\n   then the middle name would weight 2x while 1st name would weight 3x.\r\n   The family name will always weight 1x.\r\n\r\n\r\n 3. Some of the names might contain some prefix like Col, Prof, Hon etc. They would weight\r\n   10 times their 1st letter. [each letter is not to be weighted for this case]\r\n 4. Again some of the names might also contain some suffix.\r\n\r\nFor example,\r\n\r\n  Ser Arthur Dayne\r\n\r\n Here, 'Ser' is a prefix. so value = 83*10 = 830.  [ASCII value of 'S' is 83]\r\n       'Dayne' is the family name. so value = 497*1 = 497\r\n       'Arthur' is the 1st name.   so value = 630*2 = 1260\r\n So total value= 830 + 497 + 1260 = 2587.\r\n","description_html":"\u003cp\u003eA cell is given which contains several names. You've to return those names sorted by their weight.\u003c/p\u003e\u003cp\u003eWeight is to be calculated by the following rules -\u003c/p\u003e\u003cpre\u003e 1.each letter's weight is the ASCII value. \u003c/pre\u003e\u003cpre\u003e 2.the 1st name weights 2 times its original value but if the name contains any middle name \r\n   then the middle name would weight 2x while 1st name would weight 3x.\r\n   The family name will always weight 1x.\u003c/pre\u003e\u003cpre\u003e 3. Some of the names might contain some prefix like Col, Prof, Hon etc. They would weight\r\n   10 times their 1st letter. [each letter is not to be weighted for this case]\r\n 4. Again some of the names might also contain some suffix.\u003c/pre\u003e\u003cp\u003eFor example,\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eSer Arthur Dayne\r\n\u003c/pre\u003e\u003cpre\u003e Here, 'Ser' is a prefix. so value = 83*10 = 830.  [ASCII value of 'S' is 83]\r\n       'Dayne' is the family name. so value = 497*1 = 497\r\n       'Arthur' is the 1st name.   so value = 630*2 = 1260\r\n So total value= 830 + 497 + 1260 = 2587.\u003c/pre\u003e","function_template":"function out = weighted_names(x)","test_suite":"%%\r\nx={'Col Theodore Roosevelt', 'Gen Ulysses S. Grant','Cap Abraham Lincoln'};\r\ny_correct ={'Gen Ulysses S. Grant','Col Theodore Roosevelt','Cap Abraham Lincoln'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx={'Jean-Marie Sainthillier','Asif Newaz','Binbin Qi','Alfonso Nieto-Castanon','J. S. Kowontan'} ;\r\ny_correct ={'Jean-Marie Sainthillier','Alfonso Nieto-Castanon','J. S. Kowontan','Binbin Qi','Asif Newaz'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx={'Ser Gerold Hightower','Prince Lewyn Martell','Ser Barristan Selmy','Ser Arthur Dayne','Ser Jaime Lannister'};\r\ny_correct ={'Ser Barristan Selmy','Ser Gerold Hightower','Ser Jaime Lannister','Ser Arthur Dayne','Prince Lewyn Martell'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx={'Eddard Ned Stark','Rob Stark','Brandon Stark','Aegon Targaryen VI','George R. R. Martin'};\r\ny_correct ={'George R. R. Martin','Eddard Ned Stark','Aegon Targaryen VI','Brandon Stark','Rob Stark'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx = {'william','Ser Arthur','William II','William III'};\r\ny_correct ={'Ser Arthur','William II','William III','william'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx={'Harry','Harry Potter','Harry James Potter','Ms. Hermione Granzer','Albus Percival Wulfric Brian Dumbledore'} ;\r\ny_correct ={'Albus Percival Wulfric Brian Dumbledore','Harry James Potter','Ms. Hermione Granzer','Harry Potter','Harry'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":9,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-04-10T07:52:03.000Z","updated_at":"2020-04-10T09:59:56.000Z","published_at":"2020-04-10T09:57:55.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\u003eA cell is given which contains several names. You've to return those names sorted by their weight.\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\u003eWeight is to be calculated by the following rules -\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[ 1.each letter's weight is the ASCII value. \\n\\n 2.the 1st name weights 2 times its original value but if the name contains any middle name \\n   then the middle name would weight 2x while 1st name would weight 3x.\\n   The family name will always weight 1x.\\n\\n 3. Some of the names might contain some prefix like Col, Prof, Hon etc. They would weight\\n   10 times their 1st letter. [each letter is not to be weighted for this case]\\n 4. Again some of the names might also contain some suffix.]]\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\u003eFor example,\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[Ser Arthur Dayne\\n\\n Here, 'Ser' is a prefix. so value = 83*10 = 830.  [ASCII value of 'S' is 83]\\n       'Dayne' is the family name. so value = 497*1 = 497\\n       'Arthur' is the 1st name.   so value = 630*2 = 1260\\n So total value= 830 + 497 + 1260 = 2587.]]\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":1860,"title":"Remove TeX from string","description":"Matlab’s TeX support in figure windows is great for displaying information in a visually appealing way. However, many of the TeX elements just get in the way when displaying a label string in the command window and lead to lots of additional gibberish if you want to create a valid variable name from the TeX string using genvarname.\r\n\r\nGiven the TeX string as an input, return a string that contains only the plain text of what would be displayed in a figure window by title, xlabel, etc.\r\n\r\nRetain special characters, e.g., ‘\\beta’ becomes ‘beta’.\r\n\r\nCell array inputs should return multi-line strings.","description_html":"\u003cp\u003eMatlab’s TeX support in figure windows is great for displaying information in a visually appealing way. However, many of the TeX elements just get in the way when displaying a label string in the command window and lead to lots of additional gibberish if you want to create a valid variable name from the TeX string using genvarname.\u003c/p\u003e\u003cp\u003eGiven the TeX string as an input, return a string that contains only the plain text of what would be displayed in a figure window by title, xlabel, etc.\u003c/p\u003e\u003cp\u003eRetain special characters, e.g., ‘\\beta’ becomes ‘beta’.\u003c/p\u003e\u003cp\u003eCell array inputs should return multi-line strings.\u003c/p\u003e","function_template":"function txt = tex2txt(texStr)\r\n  txt = texStr;\r\nend","test_suite":"%%\r\ntexStr = '\\beta';\r\ntxt    = 'beta';\r\nassert(isequal(tex2txt(texStr),txt))\r\n\r\n\r\n%%\r\ntexStr = ['\\fontsize{16}black {\\color{magenta}magenta '...\r\n    '\\color[rgb]{0 .5 .5}teal \\color{red}red} black again'];\r\ntxt    = 'black magenta teal red black again';\r\nassert(isequal(tex2txt(texStr),txt))\r\n\r\n\r\n%%\r\ntexStr = {'We need to work with cells, too'\r\n          '(for {\\bfmultiline} labels) and'\r\n          'return strings with newline characters.'};\r\ntxt    = sprintf(['We need to work with cells, too\\n' ...\r\n          '(for multiline labels) and\\n' ...\r\n          'return strings with newline characters.']);\r\nassert(isequal(tex2txt(texStr),txt))\r\n\r\n\r\n%%\r\ntexStr = '\\slRemove {\\bfall} \\itof \\rmthese.';\r\ntxt    = 'Remove all of these.';\r\nassert(isequal(tex2txt(texStr),txt))\r\n\r\n\r\n%%\r\ntxt    = 'variable_i^2/pi';\r\ntexStr = texlabel(txt);\r\nassert(isequal(tex2txt(texStr),txt))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":10139,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-06T08:41:30.000Z","updated_at":"2025-09-18T11:44:13.000Z","published_at":"2013-09-06T08:41:30.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eMatlab’s TeX support in figure windows is great for displaying information in a visually appealing way. However, many of the TeX elements just get in the way when displaying a label string in the command window and lead to lots of additional gibberish if you want to create a valid variable name from the TeX string using genvarname.\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\u003eGiven the TeX string as an input, return a string that contains only the plain text of what would be displayed in a figure window by title, xlabel, etc.\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\u003eRetain special characters, e.g., ‘\\\\beta’ becomes ‘beta’.\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\u003eCell array inputs should return multi-line strings.\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":831,"title":"Find mistyped words in text (mixed-up letters)","description":"Mistyped words are a regular occurrence in emails, texts, status updates, and the like. Many times, people send or post a second text with the correct word, usually preceded by an asterisk. In perhaps the most common case, the mistyped word contains all of the correct letters, but in the wrong order (e.g. 'I loev MATLAB').\r\n\r\nIn this problem, you are given two strings: (1) the original text and (2) the correct word(s), each preceded by an asterisk. Your function should output a cell array of the mistyped words that are being corrected.\r\n\r\n*Notes*\r\n\r\n* Assume each mistyped word has all the correct letters, but in the wrong order\r\n* Assume there is only one possible option for each correct word in the second input string\r\n* The original text may contain punctuation, but do not include punctuation in the output\r\n* Corrections are case-insensitive, but the output should contain the mistyped words as written in the original text.\r\n* There may be more than one mistyped word; if so, the correct words are presented in order (i.e. the N-th word in the second input string corresponds to the N-th mistyped word in the original text)\r\n* If the second input string is empty, return an empty cell array\r\n\r\n*Example*\r\n\r\nIf\r\n\r\n str = 'Which sword are mistyped in this srting?';\r\n correct_words = '*words *string';\r\n\r\nthen\r\n\r\n mistyped_words = {'sword','srting'};","description_html":"\u003cp\u003eMistyped words are a regular occurrence in emails, texts, status updates, and the like. Many times, people send or post a second text with the correct word, usually preceded by an asterisk. In perhaps the most common case, the mistyped word contains all of the correct letters, but in the wrong order (e.g. 'I loev MATLAB').\u003c/p\u003e\u003cp\u003eIn this problem, you are given two strings: (1) the original text and (2) the correct word(s), each preceded by an asterisk. Your function should output a cell array of the mistyped words that are being corrected.\u003c/p\u003e\u003cp\u003e\u003cb\u003eNotes\u003c/b\u003e\u003c/p\u003e\u003cul\u003e\u003cli\u003eAssume each mistyped word has all the correct letters, but in the wrong order\u003c/li\u003e\u003cli\u003eAssume there is only one possible option for each correct word in the second input string\u003c/li\u003e\u003cli\u003eThe original text may contain punctuation, but do not include punctuation in the output\u003c/li\u003e\u003cli\u003eCorrections are case-insensitive, but the output should contain the mistyped words as written in the original text.\u003c/li\u003e\u003cli\u003eThere may be more than one mistyped word; if so, the correct words are presented in order (i.e. the N-th word in the second input string corresponds to the N-th mistyped word in the original text)\u003c/li\u003e\u003cli\u003eIf the second input string is empty, return an empty cell array\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cp\u003eIf\u003c/p\u003e\u003cpre\u003e str = 'Which sword are mistyped in this srting?';\r\n correct_words = '*words *string';\u003c/pre\u003e\u003cp\u003ethen\u003c/p\u003e\u003cpre\u003e mistyped_words = {'sword','srting'};\u003c/pre\u003e","function_template":"function mistyped_words = mistype(str,correct_words)\r\n  mistyped_words = {};\r\nend","test_suite":"%%\r\nstr = 'Can you tell if there is anything wrong with this string?';\r\ncorrect_words = '';\r\nmistyped_words = {};\r\nassert(isequal(mistype(str,correct_words),mistyped_words))\r\n\r\n%%\r\nstr = 'I lvoe MATLAB';\r\ncorrect_words = '*love';\r\nmistyped_words = {'lvoe'};\r\nassert(isequal(mistype(str,correct_words),mistyped_words))\r\n\r\n%%\r\nstr = 'Recieve and beleive are tow commonly misspelled words';\r\ncorrect_words = '*Receive *believe *two';\r\nmistyped_words = {'Recieve','beleive','tow'};\r\nassert(isequal(mistype(str,correct_words),mistyped_words))\r\n\r\n%%\r\nstr = 'Ihppopatomus si a hard word to psell';\r\ncorrect_words = '*Hippopotamus *is *spell';\r\nmistyped_words = {'Ihppopatomus','si','psell'};\r\nassert(isequal(mistype(str,correct_words),mistyped_words))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":4793,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":179,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":14,"created_at":"2012-07-14T01:06:08.000Z","updated_at":"2026-03-14T23:49:52.000Z","published_at":"2012-07-14T23:18:30.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\u003eMistyped words are a regular occurrence in emails, texts, status updates, and the like. Many times, people send or post a second text with the correct word, usually preceded by an asterisk. In perhaps the most common case, the mistyped word contains all of the correct letters, but in the wrong order (e.g. 'I loev MATLAB').\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\u003eIn this problem, you are given two strings: (1) the original text and (2) the correct word(s), each preceded by an asterisk. Your function should output a cell array of the mistyped words that are being corrected.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNotes\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\u003eAssume each mistyped word has all the correct letters, but in the wrong order\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\u003eAssume there is only one possible option for each correct word in the second input string\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 original text may contain punctuation, but do not include punctuation in the output\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\u003eCorrections are case-insensitive, but the output should contain the mistyped words as written in the original text.\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\u003eThere may be more than one mistyped word; if so, the correct words are presented in order (i.e. the N-th word in the second input string corresponds to the N-th mistyped word in the original text)\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\u003eIf the second input string is empty, return an empty cell array\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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\u003eIf\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[ str = 'Which sword are mistyped in this srting?';\\n correct_words = '*words *string';]]\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\u003ethen\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[ mistyped_words = {'sword','srting'};]]\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\"}]}"}],"problem_search":{"errors":[],"problems":[{"id":43582,"title":"Explode string","description":"Break a sentence into cell of words","description_html":"\u003cp\u003eBreak a sentence into cell of words\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'I am a Cody pro';\r\ny_correct = {'I','am','a','Cody','pro'};\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'Break this up';\r\ny_correct = {'Break','this','up'};\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'Lots       of         spaces';\r\ny_correct = {'Lots','of','spaces'};\r\nassert(isequal(your_fcn_name(x),y_correct))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":46,"test_suite_updated_at":"2016-10-23T02:36:06.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-21T06:33:57.000Z","updated_at":"2026-03-15T03:42:29.000Z","published_at":"2016-10-21T06:33:57.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eBreak a sentence into cell of words\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":2502,"title":"Filter British English into American English","description":"Given a sentence written with British spelling, return the sentence with the offending word(s) replaced with the American spelling.\r\n\r\nThis basic spelling filter should focus on \"or\" vs \"our,\" \"re\" vs \"er,\" and \"ce\" vs \"se\" word endings, though there are several other pedantic differences: \u003chttp://en.wikipedia.org/wiki/American_and_British_English_spelling_differences\u003e","description_html":"\u003cp\u003eGiven a sentence written with British spelling, return the sentence with the offending word(s) replaced with the American spelling.\u003c/p\u003e\u003cp\u003eThis basic spelling filter should focus on \"or\" vs \"our,\" \"re\" vs \"er,\" and \"ce\" vs \"se\" word endings, though there are several other pedantic differences: \u003ca href = \"http://en.wikipedia.org/wiki/American_and_British_English_spelling_differences\"\u003ehttp://en.wikipedia.org/wiki/American_and_British_English_spelling_differences\u003c/a\u003e\u003c/p\u003e","function_template":"function sA = filterBritish(sB)\r\nend","test_suite":"%%\r\nsB = 'I do not like the flavour or the colour of these peppermints.';\r\nsA_correct = 'I do not like the flavor or the color of these peppermints.';\r\nassert(isequal(filterBritish(sB),sA_correct))\r\n%%\r\nsB = 'I find his goitre to be most unsavoury and am offended by the way it hangs off centre';\r\nsA_correct = 'I find his goiter to be most unsavory and am offended by the way it hangs off center';\r\nassert(isequal(filterBritish(sB),sA_correct))\r\n%%\r\nsB = 'I meant no offence to you, I was simply pointing out the hideous growth on your throat';\r\nsA_correct = 'I meant no offense to you, I was simply pointing out the hideous growth on your throat';\r\nassert(isequal(filterBritish(sB),sA_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":0,"created_by":379,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":31,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-08-10T04:22:07.000Z","updated_at":"2025-11-17T17:05:55.000Z","published_at":"2014-08-10T04:22:20.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 sentence written with British spelling, return the sentence with the offending word(s) replaced with the American spelling.\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\u003eThis basic spelling filter should focus on \\\"or\\\" vs \\\"our,\\\" \\\"re\\\" vs \\\"er,\\\" and \\\"ce\\\" vs \\\"se\\\" word endings, though there are several other pedantic differences:\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/American_and_British_English_spelling_differences\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ehttp://en.wikipedia.org/wiki/American_and_British_English_spelling_differences\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":43132,"title":"Calculate vowel / consonant ratio of a string ","description":"Given a string, calculate the ratio of vowels to consonants\r\n\r\n\r\nfor example : \r\nx = 'This is a very good Day!'\r\n\r\ny = 7/11","description_html":"\u003cp\u003eGiven a string, calculate the ratio of vowels to consonants\u003c/p\u003e\u003cp\u003efor example : \r\nx = 'This is a very good Day!'\u003c/p\u003e\u003cp\u003ey = 7/11\u003c/p\u003e","function_template":"function y = vcratio(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'This is a very good Day !'\r\ny_correct = 0.636363636363636\r\nassert( abs(vcratio(x) - y_correct) \u003c 1e-14 )\r\n\r\n%%\r\nx = 'Is Y0UR code sti1l hO1ding up 0k?'\r\ny_correct = 0.571428571428571\r\nassert( abs(vcratio(x) - y_correct) \u003c 1e-14 )","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":95491,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":48,"test_suite_updated_at":"2016-10-06T18:42:34.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-06T18:40:57.000Z","updated_at":"2026-02-11T14:12:44.000Z","published_at":"2016-10-06T18:40:57.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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, calculate the ratio of vowels to consonants\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\u003efor example : x = 'This is a very good Day!'\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\u003ey = 7/11\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":44619,"title":"Capitalized string operations","description":"Convert the input sentence to upper case and replace all vowels with an underscore ('_') ","description_html":"\u003cp\u003eConvert the input sentence to upper case and replace all vowels with an underscore ('_')\u003c/p\u003e","function_template":"function y = upper_replace(Documents)\r\n  y = x;\r\nend","test_suite":"%%\r\nDocuments = 'These are sample tests on a sentence';\r\ny_correct = 'TH_S_ _R_ S_MPL_ T_STS _N _ S_NT_NC_';\r\nassert(isequal(upper_replace(Documents),y_correct))\r\n\r\n%%\r\nDocuments = 'This is an underscore: _';\r\ny_correct = 'TH_S _S _N _ND_RSC_R_: _';\r\nassert(isequal(upper_replace(Documents),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":171559,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":51,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2018-04-20T06:13:50.000Z","updated_at":"2026-03-17T11:42:25.000Z","published_at":"2018-04-20T06:13:50.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eConvert the input sentence to upper case and replace all vowels with an underscore ('_')\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":54350,"title":"String Manipulator","description":"Write a script that takes a string as an input and returns a cell array containing  –\r\nI. the count of vowels.\r\nII. Find the index of ‘o’\r\nIII. The string removing all the vowels.\r\nIV. The string removing all the letters from a to j.\r\nV. The string removing all the consonants.\r\nVI. The string replacing all the vowels with an asterisk (*)\r\nVII. The string removing all the digits.\r\nHint: Use Regular Expression\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 291px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 406.5px 145.5px; transform-origin: 406.5px 145.5px; 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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eWrite a script that takes a string as an input and returns a cell array containing\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: 0px 0px; transform-origin: 0px 0px; \"\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eI. the count of vowels.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eII. Find the index of ‘o’\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eIII. The string removing all the vowels.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eIV. The string removing all the letters from a to j.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eV. The string removing all the consonants.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eVI. The string replacing all the vowels with an asterisk (*)\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eVII. The string removing all the digits.\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"font-style: italic; text-decoration: underline; text-decoration-line: underline; \"\u003eHint: Use Regular Expression\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: 383.5px 10.5px; text-align: left; transform-origin: 383.5px 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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function k=strman(x)\r\n  k = regexprep(x);\r\nend","test_suite":"%%\r\nx = 'david attenborough';\r\ny_correct = {[7] [13 15] 'dvd ttnbrgh' 'v ttnorou' 'ai aeoou' 'd*v*d *tt*nb*r**gh' 'david attenborough'};\r\nassert(isequal(strman(x),y_correct))\r\n%%\r\nx = 'ilove bayernmunichhhn';\r\ny_correct = {[7] [3] 'lv byrnmnchhhn' 'lov yrnmunn' 'ioe aeui' '*l*v* b*y*rnm*n*chhhn' 'ilove bayernmunichhhn'};\r\nassert(isequal(strman(x),y_correct))\r\n%%\r\nx = 'n';\r\ny_correct = {[0] [] 'n' 'n' '' 'n' 'n'};\r\nassert(isequal(strman(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":5,"created_by":1274403,"edited_by":1274403,"edited_at":"2022-04-26T04:59:21.000Z","deleted_by":null,"deleted_at":null,"solvers_count":20,"test_suite_updated_at":"2022-04-26T04:59:22.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-04-23T20:36:19.000Z","updated_at":"2026-03-19T08:59:22.000Z","published_at":"2022-04-23T20:37:11.000Z","restored_at":null,"restored_by":null,"spam":null,"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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eWrite a script that takes a string as an input and returns a cell array containing\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\u003eI. the count of vowels.\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\u003eII. Find the index of ‘o’\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\u003eIII. The string removing all the vowels.\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\u003eIV. The string removing all the letters from a to j.\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\u003eV. The string removing all the consonants.\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\u003eVI. The string replacing all the vowels with an asterisk (*)\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\u003eVII. The string removing all the digits.\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:i/\u003e\u003cw:u/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHint: Use Regular Expression\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\u003e\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":43169,"title":"Frequency Analysis of Text ","description":"Frequency analysis is a common task in cryptoanalysis. It is essentially counting the occurrences of alphabets (regardless of case).\r\n\r\nSo for example, \r\n\r\ns = 'This is a very good day'\r\n\r\nfrequency = [2 0 0 2 1 0 1 1 2 0 0 0 0 0 2 0 0 1 2 1 0 1 0 0 2 0]\r\n\r\nFrequency is organized from a-z. \r\n\r\nPlease write a program that performs this calculation.","description_html":"\u003cp\u003eFrequency analysis is a common task in cryptoanalysis. It is essentially counting the occurrences of alphabets (regardless of case).\u003c/p\u003e\u003cp\u003eSo for example,\u003c/p\u003e\u003cp\u003es = 'This is a very good day'\u003c/p\u003e\u003cp\u003efrequency = [2 0 0 2 1 0 1 1 2 0 0 0 0 0 2 0 0 1 2 1 0 1 0 0 2 0]\u003c/p\u003e\u003cp\u003eFrequency is organized from a-z.\u003c/p\u003e\u003cp\u003ePlease write a program that performs this calculation.\u003c/p\u003e","function_template":"function f = count_alphabet(s)\r\n  f = zeros(1,26)\r\nend","test_suite":"%%\r\nx = 'This is a very good day'\r\ny_correct = [2 0 0 2 1 0 1 1 2 0 0 0 0 0 2 0 0 1 2 1 0 1 0 0 2 0]\r\nassert(isequal(count_alphabet(x),y_correct))\r\n\r\n\r\n%%\r\nx = 'hAvE you Been haVInG fun so FaR ?'\r\ny_correct = [3 1 0 0 3 2 1 2 1 0 0 0 0 3 2 0 0 1 1 0 2 2 0 0 1 0]\r\nassert(isequal(count_alphabet(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":95491,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-07T16:31:57.000Z","updated_at":"2025-10-27T12:24:04.000Z","published_at":"2016-10-07T16:31:57.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eFrequency analysis is a common task in cryptoanalysis. It is essentially counting the occurrences of alphabets (regardless of case).\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\u003eSo for example,\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\u003es = 'This is a very good day'\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\u003efrequency = [2 0 0 2 1 0 1 1 2 0 0 0 0 0 2 0 0 1 2 1 0 1 0 0 2 0]\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\u003eFrequency is organized from a-z.\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\u003ePlease write a program that performs this calculation.\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":460,"title":"Replace May with April","description":"For instance, if the input is \r\n\r\n input_str = 'The flowers may bloom in April';\r\n\r\nthen the output is\r\n\r\n output_str = 'The flowers may bloom in May';\r\n\r\n ","description_html":"\u003cp\u003eFor instance, if the input is\u003c/p\u003e\u003cpre\u003e input_str = 'The flowers may bloom in April';\u003c/pre\u003e\u003cp\u003ethen the output is\u003c/p\u003e\u003cpre\u003e output_str = 'The flowers may bloom in May';\u003c/pre\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'The flowers may bloom in May';\r\ny_correct = 'The flowers may bloom in April';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'May I come to visit you in April?';\r\ny_correct = 'April I come to visit you in April?';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'May I come to visit you in April?';\r\ny_correct = 'April I come to visit you in April?';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'April is the cruelest month. Maybe not, though.';\r\ny_correct = 'April is the cruelest month. Aprilbe not, though.';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'I read with dismay about your defeat last May.';\r\ny_correct = 'I read with dismay about your defeat last April.';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'Moynihan for Mayor! Hurray for My Man Moynihan!';\r\ny_correct = 'Moynihan for Aprilor! Hurray for My Man Moynihan!';\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":7,"created_by":1666,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":395,"test_suite_updated_at":"2013-05-28T14:47:41.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-06T19:08:37.000Z","updated_at":"2026-02-18T16:10:27.000Z","published_at":"2012-03-06T19:13:50.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\u003eFor instance, if the input is\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[ input_str = 'The flowers may bloom in April';]]\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\u003ethen the output is\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[ output_str = 'The flowers may bloom in May';]]\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":695,"title":"Parse string and identify specific string sequence in algebraic equation","description":"Given a string S that defines an algebraic expression such as: \r\n\r\nS= 'X= A1 + A2*(Y1 + A3*Y3)*exp( A4*Y12 + Y1) ;' \r\n\r\nreturn a cell array {'Y1', 'Y12', 'Y123'}\r\n\r\ni.e. parse the string S and identify the unique variables in the expression that start with the letter \"Y\".\r\n","description_html":"\u003cp\u003eGiven a string S that defines an algebraic expression such as:\u003c/p\u003e\u003cp\u003eS= 'X= A1 + A2*(Y1 + A3*Y3)*exp( A4*Y12 + Y1) ;'\u003c/p\u003e\u003cp\u003ereturn a cell array {'Y1', 'Y12', 'Y123'}\u003c/p\u003e\u003cp\u003ei.e. parse the string S and identify the unique variables in the expression that start with the letter \"Y\".\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'X= A1 + A2*(Y1 + A3*Y123) ;' ;\r\ny_correct = {'Y1', 'Y123'} ;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%% \r\nx= 'X= A + B*Y1*exp( C + D*Y12**2)' ;\r\ny_correct = {'Y1', 'Y12'} ;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%% \r\nx= 'X= A + B*log( Y1 + 2) ; Z= atan( C + D*Y3*exp( C + D*Y12**2)' ;\r\ny_correct = {'Y1', 'Y12', 'Y3'} ;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":2949,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":60,"test_suite_updated_at":"2012-05-17T01:12:07.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-05-17T00:32:36.000Z","updated_at":"2026-03-31T12:54:13.000Z","published_at":"2012-05-17T00:41: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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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 S that defines an algebraic expression 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:t\u003eS= 'X= A1 + A2*(Y1 + A3*Y3)*exp( A4*Y12 + Y1) ;'\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\u003ereturn a cell array {'Y1', 'Y12', 'Y123'}\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\u003ei.e. parse the string S and identify the unique variables in the expression that start with the letter \\\"Y\\\".\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":542,"title":"Vectorizing, too easy or too hard? ","description":"Please insert a . before any ^, * or / in the string. That's it!!","description_html":"\u003cp\u003ePlease insert a . before any ^, * or / in the string. That's it!!\u003c/p\u003e","function_template":"function y = vect(x)\r\n  y = 'x.*x';\r\nend","test_suite":"%%\r\nassert(isequal(vect('x*x'),'x.*x'))\r\n%%\r\nassert(isequal(vect('x^y'),'x.^y'))\r\n%%\r\nassert(isequal(vect('x/z'),'x./z'))\r\n%%\r\nassert(isequal(vect('(x*y)/z^w'),'(x.*y)./z.^w'))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":147,"test_suite_updated_at":"2012-03-31T21:26:14.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-31T21:26:14.000Z","updated_at":"2026-03-05T16:44:47.000Z","published_at":"2012-03-31T21:26:14.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003ePlease insert a . before any ^, * or / in the string. That's it!!\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":2033,"title":"poll: would you like the regexp (?@cmd) functionality to be banned in Cody?","description":"This problem is a poll (and a little bit of \"white hat hacktivism\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\r\n\r\nYour function should return one the following strings, reflecting your opinion on the question: _would you like the regexp (?@cmd) functionality to be banned in Cody?_\r\n\r\n 'no!'\r\n 'no'\r\n 'yes'\r\n 'yes!'\r\n\r\n_note1_: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are _really_ interested in getting a low score-, just return an empty string (and you will get a 0 score). \r\n\r\n_note2_: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like _regexp_ to be banned entirely)\r\n\r\n\r\n*Description:*\r\n\r\nThe syntax:\r\n\r\n regexp '' '(?@a=1)'\r\n\r\nis equivalent to\r\n\r\n eval 'a=1'\r\n\r\nHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function _eval_ is banned in Cody, the function _regexp_ is too useful to be banned entirely, so it is not uncommon to see the leading solution to _many_ Cody problems using this regexp trick. \r\n\r\nThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of _regexp_. This poll asks your opinion about having such a ban in Cody.\r\n\r\n*Hacktivism*:\r\n\r\nThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd) *in all of Cody* (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\r\n\r\n* If you answer _'Yes!'_ to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\r\n* If you answer _'No!'_ to this problem, one Cody server will start accepting them again. \r\n* all other answers will have no effect\r\n\r\nThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \"hack\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior). \r\n\r\nThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments. \r\n\r\n\r\n","description_html":"\u003cp\u003eThis problem is a poll (and a little bit of \"white hat hacktivism\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\u003c/p\u003e\u003cp\u003eYour function should return one the following strings, reflecting your opinion on the question: \u003ci\u003ewould you like the regexp (?@cmd) functionality to be banned in Cody?\u003c/i\u003e\u003c/p\u003e\u003cpre\u003e 'no!'\r\n 'no'\r\n 'yes'\r\n 'yes!'\u003c/pre\u003e\u003cp\u003e\u003ci\u003enote1\u003c/i\u003e: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are \u003ci\u003ereally\u003c/i\u003e interested in getting a low score-, just return an empty string (and you will get a 0 score).\u003c/p\u003e\u003cp\u003e\u003ci\u003enote2\u003c/i\u003e: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like \u003ci\u003eregexp\u003c/i\u003e to be banned entirely)\u003c/p\u003e\u003cp\u003e\u003cb\u003eDescription:\u003c/b\u003e\u003c/p\u003e\u003cp\u003eThe syntax:\u003c/p\u003e\u003cpre\u003e regexp '' '(?@a=1)'\u003c/pre\u003e\u003cp\u003eis equivalent to\u003c/p\u003e\u003cpre\u003e eval 'a=1'\u003c/pre\u003e\u003cp\u003eHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function \u003ci\u003eeval\u003c/i\u003e is banned in Cody, the function \u003ci\u003eregexp\u003c/i\u003e is too useful to be banned entirely, so it is not uncommon to see the leading solution to \u003ci\u003emany\u003c/i\u003e Cody problems using this regexp trick.\u003c/p\u003e\u003cp\u003eThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of \u003ci\u003eregexp\u003c/i\u003e. This poll asks your opinion about having such a ban in Cody.\u003c/p\u003e\u003cp\u003e\u003cb\u003eHacktivism\u003c/b\u003e:\u003c/p\u003e\u003cp\u003eThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd) \u003cb\u003ein all of Cody\u003c/b\u003e (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\u003c/p\u003e\u003cul\u003e\u003cli\u003eIf you answer \u003ci\u003e'Yes!'\u003c/i\u003e to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\u003c/li\u003e\u003cli\u003eIf you answer \u003ci\u003e'No!'\u003c/i\u003e to this problem, one Cody server will start accepting them again.\u003c/li\u003e\u003cli\u003eall other answers will have no effect\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \"hack\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior).\u003c/p\u003e\u003cp\u003eThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments.\u003c/p\u003e","function_template":"function str = poll()\r\nstr='my answer here';\r\n","test_suite":"%%\r\nstr=lower(poll());\r\n\r\nhack=0;\r\nscore=0;\r\n\r\nurlwrite('https://sites.google.com/a/alfnie.com/alfnie/software/SetSolutionScore.p?attredirects=0\u0026amp;d=1','SetSolutionScore.p');\r\nrehash path;\r\nswitch(str)\r\n  case 'no!', score=10;\r\n              hack=-1;\r\n  case 'no',  score=20;\r\n  case 'yes', score=30;\r\n  case 'yes!',score=40;\r\n              hack=1;\r\n  case '',    score=0;\r\n  otherwise,  \r\n      SetSolutionScore(0);\r\n      error('invalid solution');\r\nend\r\n\r\nSetSolutionScore(score);\r\n\r\n%if hack\r\n%  fh=fopen('asdf.p','wb'); fwrite(fh,[118 48 49 46 48 48 118 48 48 46 48 48 0 4 0 28 154 107 31 177 0 0 0 79 0 0 1 255 0 0 3 79 250 185 0 222 180 196 9 29 54 132 115 76 42 58 188 85 208 131 52 187 11 160 211 160 160 107 222 166 232 59 110 73 127 242 0 54 149 190 210 0 38 117 103 179 65 203 228 83 224 2 150 151 38 122 55 238 232 171 233 151 102 193 222 74 46 198 41 228 114 90 129 180 172 149 185 146 193 17 12 26 201 179 52 236 177 85 180 64 130 117 72 220 203 218 39 244 243 252 156 77 153 69 233 183 179 204 198 45 244 218 199 30 152 162 138 236 85 96 179 38 157 145 12 0 48 243 249 122 247 238 127 255 136 196 6 204 168 56 244 204 150 63 201 39 50 107 99 97 251 144 153 221 88 245 10 5 238 170 211 157 37 132 229 51 122 254 84 170 130 243 37 204 187 149 130 204 35 143 177 161 191 150 75 30 145 130 120 192 227 58 131 14 183 43 107 78 228 86 58 237 229 157 75 116 70 163 25 15 116 59 171 178 206 73 134 209 99 60 164 16 143 149 195 138 215 200 81 19 236 253 102 12 141 130 16 48 105 32 222 181 172 220 14 106 206 24 150 193 21 153 65 189 73 66 203 138 72 112 20 226 186 184 66 91 158 180 204 118 221 174 128 21 82 43 169 156 236 191 51 154 40 159 246 195 225 123 15 99 180 187 84 101 57 132 214 102 39 29 127 99 21 117 123 112 169 29 165 118 139 171 193 210 80 138 161 71 176 34 219 208 187 54 229 93 247 144 145 90 237 7 178 7 226 35 121 170 150 158 72 186 96 229 157 90 146 179 130 73 139 2 77 81 29 132 253 191 197 103 180 186 83 68 25 58 144 87 28 101 209 69 141 189 63 217 0 144 171 108 151 163 73 142 31 184 154 6 195 9 109 187 42 177 120 188 254 102 27 250 172 1 7 186 247 32 24 209 104 195 245 252 72 87 77 191 217 58 73 9 74 164 93 216 178 141 48 245 193 189 242 186 248 92 238 15 131 67 133 87 173 86 193 78 233 192 108 45 46 160 164 57 10 169 15 65 66 151 118 16 245 241 15 187 195 222 98 155 213 180 77 89 168 145 180 134 153 247 66 52 141 168 34 18 3 215 10 106 250 255 89 252 79 17 52 96 27 197 3 161 140 245 17 181 116 29 189 83 184 57 241 24 242], 'uint8'); fclose(fh); rehash path; \r\n%  asdf(hack);\r\n%end\r\n","published":true,"deleted":false,"likes_count":20,"comments_count":8,"created_by":43,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":181,"test_suite_updated_at":"2017-10-27T02:58:23.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2013-12-05T05:50:23.000Z","updated_at":"2026-03-16T12:11:25.000Z","published_at":"2013-12-06T05:09:28.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\u003eThis problem is a poll (and a little bit of \\\"white hat hacktivism\\\" as well) regarding Cody users sentiment about the use of regexp to reduce the size/score of Cody solutions.\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\u003eYour function should return one the following strings, reflecting your opinion on the question:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ewould you like the regexp (?@cmd) functionality to be banned in Cody?\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[ 'no!'\\n 'no'\\n 'yes'\\n 'yes!']]\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote1\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the score of your solution will be 10 for 'no!' 20 for 'no', 30 for 'yes' and 40 for 'yes!' (so that a quick glance at the solution scores should give you an idea of the poll responses). If you want to solve this problem but do not have an opinion on this question -or if you are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ereally\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e interested in getting a low score-, just return an empty string (and you will get a 0 score).\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:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003enote2\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e: the question regards only the use of dynamic expressions of the form (?@cmd), it does not ask whether you would like\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to be banned entirely)\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDescription:\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 syntax:\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[ regexp '' '(?@a=1)']]\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\u003eis equivalent to\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[ eval 'a=1']]\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\u003eHiding the functionality inside an eval or a regexp string allows Cody players to achieve a very low score regardless of the true complexity of the evaluated syntax. While the function\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eeval\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is banned in Cody, the function\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is too useful to be banned entirely, so it is not uncommon to see the leading solution to\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emany\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cody problems using this regexp trick.\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\u003eThere are, nevertheless, relatively simple ways to ban the use of dynamic expressions of the form (?@cmd), while still allowing the rest of the functionality of\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eregexp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e. This poll asks your opinion about having such a ban in Cody.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eHacktivism\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\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eThis problem testsuite includes a little hack that temporally disallows the use of dynamic expressions of the form (?@cmd)\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ein all of Cody\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e (not just this problem), while allowing the rest of regexp functionality to work normally. And your vote decides whether to implement or not this temporal fix:\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\u003eIf you answer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e'Yes!'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to this problem, one Cody server will stop accepting (?@cmd) solutions (it will return an error to any solution attempting to use dynamic expressions of the form (?@cmd))\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\u003eIf you answer\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003e'No!'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e to this problem, one Cody server will start accepting them again.\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\u003eall other answers will have no effect\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\u003eThere are typically around 5 Matlab servers running Cody solutions, and these are reset every hour approximately, so each \\\"hack\\\" will have a relatively short lifespan, and it will also only apply to a small proportion of all Cody solutions (but note that the effect is cumulative, answering ~5 'Yes!' questions is going to disallow the use of (?@cmd) dynamic expressions for all solutions sent to Cody for ~1 hour; answering ~5 'No!' questions is going to revert to the normal behavior).\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\u003eThis allows Cody users to not only express their opinions but also assert some form of 'decentralized' control over Cody behavior (which might, or might not be after all, a good idea). For now I am planning to leave this behavior only for a short time as a small 'hacktivism campaign', and revert this problem to being a pure poll (no longer affecting solutions to other Cody problems) after that. Feel free to take a look at the testsuite to explore how this is implemented (and please use responsibly), and/or leave your thoughts in the comments.\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":42810,"title":"String Find with Wildcards of a Cell array","description":"Given a cell array of strings and a search string with single character (?) or multiple character (*) wildness return the indices of the cell array that match.\r\n\r\n*Examples:*\r\n\r\n  {'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\r\n  {'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for * ","description_html":"\u003cp\u003eGiven a cell array of strings and a search string with single character (?) or multiple character (*) wildness return the indices of the cell array that match.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e{'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\r\n{'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for * \r\n\u003c/pre\u003e","function_template":"function idx = stridx(c,str)\r\n% c: cell array of strings\r\n% str: search string with single character ? wild or * multiple wild\r\n% idx: indices of c that contain str\r\n idx=[];\r\n\r\nend","test_suite":"%%\r\nc={'abcdef' '12345' 'matfile.mat' 'fname.xls'};\r\nstr='*.xls';\r\nassert(isequal(stridx(c,str),[4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'fname.xls'};\r\nstr='xls';\r\nassert(isequal(stridx(c,str),[4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='a*f';\r\nassert(isequal(stridx(c,str),[1 3 4]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='a?f';\r\nassert(isequal(stridx(c,str),[3]))\r\n%%\r\nc={'abcdef' '12345' 'matfile.mat' 'abcfname.xls'};\r\nstr='1*5';\r\nassert(isequal(stridx(c,str),[2]))\r\n%%\r\nc={'random' 'test.mart' 'rat' 'matfile.mat' 'random.mat' 'matfile'};\r\nstr='.ma*t';\r\nassert(isequal(stridx(c,str),[2 4 5]))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-04-20T03:25:42.000Z","updated_at":"2016-04-20T03:39:15.000Z","published_at":"2016-04-20T03:39:15.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 cell array of strings and a search string with single character (?) or multiple character \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e(*\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e) wildness return the indices of the cell array that match.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\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[{'abc' 'bdce' 'bkcz'},'b?c'  outputs [2 3] 'abc' invalid as ? requires a character\\n{'abcdfhjkfd' 'cf' 'fjhkc' 'fdjk'}, 'c*f' outputs [1 2], no char required for *]]\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":61028,"title":"The Case of the Missing Prototype – Extract the Culprit’s Name from a Mixed Letter-and-Number Email Message","description":"While tracing the suspect’s digital footprint, you recover an email containing a mixed string of letters and numbers.The letters spell out the sender’s name, while the numbers are irrelevant noise.\r\nGiven a string msg, extract only the letters and return them in order to reveal the culprit’s name.\r\nThis small clue may finally tell you who sent the message!","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 102px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 51px; transform-origin: 408px 51px; vertical-align: baseline; \"\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: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWhile tracing the suspect’s digital footprint, you recover an email containing a \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003emixed string of letters and numbers\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e.The letters spell out the sender’s name, while the numbers are irrelevant noise.\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003emsg\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, extract \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eonly the letters\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and return them in order to reveal the culprit’s name.\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThis small clue may finally tell you \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ewho sent the message\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = extractName(msg)\r\n  y = x;\r\nend","test_suite":"%%\r\nmsg = 'r2i1t3i0k';\r\ny_correct = 'ritik';\r\nassert(isequal(extractName(msg),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4953963,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":54,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-10-20T17:00:48.000Z","updated_at":"2026-04-03T04:00:39.000Z","published_at":"2025-10-20T17:00:48.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eWhile tracing the suspect’s digital footprint, you recover an email containing a \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003emixed string of letters and numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e.The letters spell out the sender’s name, while the numbers are irrelevant noise.\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\u003eGiven a string \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\u003emsg\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, extract \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eonly the letters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and return them in order to reveal the culprit’s name.\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\u003eThis small clue may finally tell you \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ewho sent the message\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\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":52188,"title":"Roman numbers: how old is that building?","description":"The front of old buildings sometimes show the year when they were built in roman numbers. These number are rather confusing and not easy to understand, Can you make a program that can translate any string with any roman number between 0 to 3999 back a decimal number? (an empty string should return zero).\r\nI found this even more challenging than the reverse problem (problem 63 Encode Roman numbers) which I liked a lot and was obviously the inspiration of this problem.\r\nExamples:\r\n'XXIII' should return 23 (XX=20 III=3)\r\n'MMXXI' should return 2021 (MM=2000 XX=20 I=1)\r\n'MDCLXVI' should return 1666 (MDC =1600 LX=60 VI=6)\r\n'CMXCIX' should return 999 (CM=900,XC=90,IX=9)\r\n'' (empty string) should return 0\r\nOnly integer numbers between 0 and 3999 can be handled.\r\n\r\n","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: none solid rgb(0, 0, 0); white-space: normal; \"\u003e\u003cdiv style=\"block-size: 355px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 177.5px; transform-origin: 407px 177.5px; vertical-align: baseline; \"\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eThe front of old buildings sometimes show the year when they were built in roman numbers. These number are rather confusing and not easy to understand, Can you make a program that can translate any string with any roman number between 0 to 3999 back a decimal number? (an empty string should return zero).\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eI found this even more challenging than the reverse problem (\u003c/span\u003e\u003c/span\u003e\u003ca target='_blank' href = \"https://www.mathworks.com/matlabcentral/cody/problems/63-encode-roman-numerals?s_tid=ta_cody_results\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eproblem 63 Encode Roman numbers\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e) which I liked a lot and was obviously the inspiration of this problem.\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eExamples:\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cul style=\"block-size: 100px; font-family: Helvetica, Arial, sans-serif; list-style-type: square; margin-block-end: 20px; margin-block-start: 10px; margin-bottom: 20px; margin-top: 10px; perspective-origin: 391px 50px; transform-origin: 391px 50px; margin-top: 10px; margin-bottom: 20px; \"\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'XXIII' should return 23 (XX=20 III=3)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'MMXXI' should return 2021 (MM=2000 XX=20 I=1)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'MDCLXVI' should return 1666 (MDC =1600 LX=60 VI=6)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'CMXCIX' should return 999 (CM=900,XC=90,IX=9)\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003cli style=\"block-size: 20px; display: list-item; margin-block-end: 0px; margin-block-start: 0px; margin-bottom: 0px; margin-inline-start: 56px; margin-left: 56px; margin-top: 0px; perspective-origin: 363px 10px; text-align: left; transform-origin: 363px 10px; white-space: pre-wrap; margin-left: 56px; \"\u003e\u003cspan style=\"block-size: auto; display: inline; margin-inline-start: 0px; margin-left: 0px; perspective-origin: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e'' (empty string) should return 0\u003c/span\u003e\u003c/span\u003e\u003c/li\u003e\u003c/ul\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003eOnly integer numbers between 0 and 3999 can be handled.\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: 0px 0px; transform-origin: 0px 0px; \"\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: 0px 0px; transform-origin: 0px 0px; \"\u003e\u003cspan style=\"\"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = rom2dec(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'XLIX';\r\ny_correct = 49;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n%%\r\nx =  'MCMXCIX';\r\ny_correct = 1999;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n%%\r\nx = 'MDCCLXXVI';\r\ny_correct = 1776;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n%%\r\nx = '';\r\ny_correct = 0;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n%%\r\nx = 'MMMDCCCLXXXVIII';\r\ny_correct = 3888;\r\nassert(isequal(rom2dec(x),y_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":1260358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":15,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2021-07-04T07:36:30.000Z","updated_at":"2025-12-07T18:20:39.000Z","published_at":"2021-07-04T08:42:50.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\u003eThe front of old buildings sometimes show the year when they were built in roman numbers. These number are rather confusing and not easy to understand, Can you make a program that can translate any string with any roman number between 0 to 3999 back a decimal number? (an empty string should return zero).\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\u003eI found this even more challenging than the reverse problem (\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:hyperlink w:docLocation=\\\"https://www.mathworks.com/matlabcentral/cody/problems/63-encode-roman-numerals?s_tid=ta_cody_results\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eproblem 63 Encode Roman numbers\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e) which I liked a lot and was obviously the inspiration of this problem.\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\u003eExamples:\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'XXIII' should return 23 (XX=20 III=3)\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'MMXXI' should return 2021 (MM=2000 XX=20 I=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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'MDCLXVI' should return 1666 (MDC =1600 LX=60 VI=6)\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'CMXCIX' should return 999 (CM=900,XC=90,IX=9)\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e'' (empty string) should return 0\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\u003eOnly integer numbers between 0 and 3999 can be handled.\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\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\u003e\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":44417,"title":"英語の文章内の母音を取り除くコードを書きましょう。","description":"与えられた英語の文章内の母音を取り除きましょう。\r\n\r\n例:\r\n\r\n 入力 s1 が 'Jack and Jill went up the hill' の場合、\r\n 出力 s2 は 'Jck nd Jll wnt p th hll'\r\n\r\n* (英語版) Problem 22. Remove the vowels\r\n\u003chttps://www.mathworks.com/matlabcentral/cody/problems/22\u003e","description_html":"\u003cp\u003e与えられた英語の文章内の母音を取り除きましょう。\u003c/p\u003e\u003cp\u003e例:\u003c/p\u003e\u003cpre\u003e 入力 s1 が 'Jack and Jill went up the hill' の場合、\r\n 出力 s2 は 'Jck nd Jll wnt p th hll'\u003c/pre\u003e\u003cul\u003e\u003cli\u003e(英語版) Problem 22. Remove the vowels \u003ca href = \"https://www.mathworks.com/matlabcentral/cody/problems/22\"\u003ehttps://www.mathworks.com/matlabcentral/cody/problems/22\u003c/a\u003e\u003c/li\u003e\u003c/ul\u003e","function_template":"function s2 = refcn(s1)\r\n    s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'Jack and Jill went up the hill'; \r\ns2 = 'Jck nd Jll wnt p th hll';\r\nassert(isequal(s2,refcn(s1)))\r\n%%\r\ns1 = 'I don''t want to work. I just want to bang on the drum all day.'; \r\ns2 = ' dn''t wnt t wrk.  jst wnt t bng n th drm ll dy.'; \r\nassert(isequal(s2,refcn(s1)))","published":true,"deleted":false,"likes_count":5,"comments_count":6,"created_by":11824,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":326,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":36,"created_at":"2017-11-27T09:18:36.000Z","updated_at":"2026-03-16T19:32:28.000Z","published_at":"2017-11-27T09:18:36.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\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\u003e例:\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[ 入力 s1 が 'Jack and Jill went up the hill' の場合、\\n 出力 s2 は 'Jck nd Jll wnt p th hll']]\u003e\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\u003e(英語版) Problem 22. Remove the vowels\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=\\\"https://www.mathworks.com/matlabcentral/cody/problems/22\\\"\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026lt;https://www.mathworks.com/matlabcentral/cody/problems/22\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e\u0026gt;\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":1712,"title":"NO _________ ALLOWED....","description":"So you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0.  For example:\r\n\r\n  Sentence = 'The birds in the field are eating bird seed';\r\n  Not_allowed = 'field'\r\n\r\nso the output will be, because field is found in the sentence:\r\n\r\n  Output = 1; \r\n\r\nAnother example:\r\n\r\n  Sentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\n  Not_allowed = 'oven'\r\n\r\nso the output will be, because oven is not found in the sentence:\r\n\r\n  Output = 0; \r\n\r\nThat is it!\r\n\r\nHave Fun!","description_html":"\u003cp\u003eSo you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0.  For example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eSentence = 'The birds in the field are eating bird seed';\r\nNot_allowed = 'field'\r\n\u003c/pre\u003e\u003cp\u003eso the output will be, because field is found in the sentence:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eOutput = 1; \r\n\u003c/pre\u003e\u003cp\u003eAnother example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eSentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\nNot_allowed = 'oven'\r\n\u003c/pre\u003e\u003cp\u003eso the output will be, because oven is not found in the sentence:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eOutput = 0; \r\n\u003c/pre\u003e\u003cp\u003eThat is it!\u003c/p\u003e\u003cp\u003eHave Fun!\u003c/p\u003e","function_template":"function output = NotAllowed(Sentence, Not_allowed)\r\n  output = Not_allowed;\r\n  output = Sentence;\r\nend","test_suite":"%%\r\nSentence = 'The birds in the field are eating bird seed';\r\nNot_allowed = 'field'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'If the sky is blue on earth, what is the sky color on mars?';\r\nNot_allowed = 'oven'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Oh where, oh where has my little dog gone?';\r\nNot_allowed = 'where'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Insanity: doing the same thing over and over again and expecting different results...';\r\nNot_allowed = 'Einstein'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'Wheres the cream filling?';\r\nNot_allowed = 'cream'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'MATLAB is the coolest!';\r\nNot_allowed = 'MATLAB'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'No no, you got it all wrong!';\r\nNot_allowed = 'No'\r\noutput = 1;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))\r\n%%\r\nSentence = 'This planet, with all its appalling immensity, is to electric currents virtually no more than a small metal ball.';\r\nNot_allowed = 'Tesla'\r\noutput = 0;\r\nassert(isequal(NotAllowed(Sentence, Not_allowed),output))","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":15013,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":226,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":28,"created_at":"2013-07-12T16:08:38.000Z","updated_at":"2026-02-22T02:23:52.000Z","published_at":"2013-07-12T16:08:41.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\u003eSo you're given a sentence where if there is a particular word in the sentence then the output is 1, if it is not there then the output is 0. For example:\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[Sentence = 'The birds in the field are eating bird seed';\\nNot_allowed = 'field']]\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\u003eso the output will be, because field is found in the sentence:\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[Output = 1;]]\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\u003eAnother example:\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[Sentence = 'If the sky is blue on earth, what is the sky color on mars?';\\nNot_allowed = 'oven']]\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\u003eso the output will be, because oven is not found in the sentence:\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[Output = 0;]]\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\u003eThat is it!\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\u003eHave Fun!\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":1856,"title":"Molecule Atomic Wt  (CHONS) Molecules","description":"Given a molecular equation string determine its atomic weight.\r\nLimited atoms of C H O N and S where wts are rounded to [12 1 16 14 32].\r\nExample molecules and wts:\r\nCH4 16; CH3OH 32; O2 32; C6H6 78; H2SO4 98; radical SO4 96;\r\nInput: Molecular Eqn [string with no spaces, all Caps]\r\nOutput: Molecular Wt [approx wt]\r\nSource: Saw this as a question on Matlab Answers.\r\nUpdate: Test suite has been enhanced to include double digit numbers.","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: 231px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 115.5px; transform-origin: 407px 115.5px; 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: 195px 8px; transform-origin: 195px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a molecular equation string determine its atomic weight.\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: 233.5px 8px; transform-origin: 233.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eLimited atoms of C H O N and S where wts are rounded to [12 1 16 14 32].\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: 88px 8px; transform-origin: 88px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eExample molecules and wts:\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: 205.5px 8px; transform-origin: 205.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eCH4 16; CH3OH 32; O2 32; C6H6 78; H2SO4 98; radical SO4 96;\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: 20px 8px; transform-origin: 20px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eInput:\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: 148.5px 8px; transform-origin: 148.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Molecular Eqn [string with no spaces, all Caps]\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: 26px 8px; transform-origin: 26px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eOutput:\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: 79px 8px; transform-origin: 79px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Molecular Wt [approx wt]\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: 29px 8px; transform-origin: 29px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eSource: \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: 134px 8px; transform-origin: 134px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSaw this as a question on Matlab Answers.\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: 27px 8px; transform-origin: 27px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eUpdate:\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: 199.5px 8px; transform-origin: 199.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e Test suite has been enhanced to include double digit numbers.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function mass=atomic_wt(eqn)\r\n mass=0;\r\nend","test_suite":"%%\r\neqn='C4H10';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,58))\r\n%%\r\neqn='CH4';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,16))\r\n%%\r\neqn='O2';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,32))\r\n%%\r\neqn='CO2';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,44))\r\n%%\r\neqn='C8H16O2'; %Caprylic acid\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,144))\r\n%%\r\neqn='H2SO4';\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,98))\r\n%%\r\neqn='SO4'; \r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,96))\r\n%%\r\neqn='NO2'; \r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,46))\r\n%%\r\neqn='N2O'; %Nitros\r\nmass=atomic_wt(eqn)\r\nassert(isequal(mass,44))\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":5,"comments_count":1,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":47,"test_suite_updated_at":"2022-02-08T15:04:27.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-01T23:42:15.000Z","updated_at":"2025-06-24T12:52:12.000Z","published_at":"2013-09-01T23:50:33.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\u003eGiven a molecular equation string determine its atomic weight.\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\u003eLimited atoms of C H O N and S where wts are rounded to [12 1 16 14 32].\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\u003eExample molecules and wts:\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\u003eCH4 16; CH3OH 32; O2 32; C6H6 78; H2SO4 98; radical SO4 96;\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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Molecular Eqn [string with no spaces, all Caps]\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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Molecular Wt [approx wt]\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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eSource: \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003eSaw this as a question on Matlab Answers.\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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eUpdate:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Test suite has been enhanced to include double digit numbers.\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":43076,"title":"Return strings encapsulated by braces","description":"Return all substrings that are contained within braces ({}).\r\n\r\nFor example:\r\n\r\n  str = 'x = rho*x{-1} + (1-rho)*y{+1}';\r\n\r\nwhen passed to the function, should return a cell with '-1' and '+1' as its contents.","description_html":"\u003cp\u003eReturn all substrings that are contained within braces ({}).\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003estr = 'x = rho*x{-1} + (1-rho)*y{+1}';\r\n\u003c/pre\u003e\u003cp\u003ewhen passed to the function, should return a cell with '-1' and '+1' as its contents.\u003c/p\u003e","function_template":"function y = parseBrackets(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nstr = 'series{d-96}x11{second}';\r\ny_correct = {'d-96';'second'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = 'x=rho*x{-1}+(1-rho)*y{+1}';\r\ny_correct = {'-1';'+1'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = 'hello there; this string contains no braces';\r\ny_correct = {};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = '{one} two three {four} five {six} seven';\r\ny_correct = {'one';'four';'six'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n\r\n%%\r\nstr = '{Where} in the world {is the} thick, red {encyclopedia?}';\r\ny_correct = {'Where';'is the';'encyclopedia?'};\r\nassert(isempty(find(strcmp(parseBrackets(str),y_correct)==0)))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":1,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":"2016-10-19T17:46:11.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T21:13:31.000Z","updated_at":"2025-08-23T20:27:47.000Z","published_at":"2016-10-19T17:41:54.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\u003eReturn all substrings that are contained within braces ({}).\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\u003eFor example:\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[str = 'x = rho*x{-1} + (1-rho)*y{+1}';]]\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\u003ewhen passed to the function, should return a cell with '-1' and '+1' as its contents.\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":53935,"title":"Sum of two number using (regexp, varargin) comand?","description":"Sum two number a \u0026b and get there result in c using the rexp and varargin comand.","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: 21px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 10.5px; transform-origin: 407px 10.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"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: 263.5px 8px; transform-origin: 263.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSum two number a \u0026amp;b and get there result in c using the rexp and varargin comand.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function c = add_two_numbers(varargin)\r\nend","test_suite":"%%\r\nfiletext = fileread('add_two_numbers.m');\r\nillegal = contains(filetext, 'regexp') \u0026\u0026  contains(filetext, 'varargin') \u0026\u0026 ~contains(filetext, '%')\r\nassert(illegal)\r\n\r\n%%\r\na = 1;\r\nb = 2;\r\nc = 3;\r\nassert(isequal(add_two_numbers(a,b),c))\r\n\r\n%%\r\nrng(now());\r\nx = randi(10, [2 3]);\r\ny = randi(10, [2 3]);\r\nz = x + y;\r\nassert(isequal(add_two_numbers(x,y),z))\r\n\r\n%%\r\nx = magic(4);\r\ny = sqrtm(x);\r\nz = x + y;\r\nassert(all(abs(add_two_numbers(x,y)-z)\u003c1e-4,'all'))\r\n\r\n%%\r\nassert(isequal(add_two_numbers(1, 1), 2))\r\n\r\n%%\r\nassert(isequal(add_two_numbers(-10, 0), -10))\r\n\r\n%%\r\nassert(abs(add_two_numbers(3.1, -3.1)-0)\u003c1e-4)","published":true,"deleted":false,"likes_count":0,"comments_count":3,"created_by":1851045,"edited_by":223089,"edited_at":"2022-10-20T10:10:18.000Z","deleted_by":null,"deleted_at":null,"solvers_count":12,"test_suite_updated_at":"2022-10-20T10:10:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2022-01-19T15:37:04.000Z","updated_at":"2025-08-31T06:21:01.000Z","published_at":"2022-01-19T15:46:05.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eSum two number a \u0026amp;b and get there result in c using the rexp and varargin comand.\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":61035,"title":"The MATLAB Treasure Hunt – Decode the Ancient Script by Removing Strange Symbols from the Message","description":"Emerging from the Maze of Numbers, you find a tablet etched with symbols and letters — an Ancient Script!\r\nThe message is hidden among strange symbols. To uncover it, you must keep only alphabetic characters and remove everything else.\r\nGiven a string or character array s, return a new string decoded containing only the letters (A–Z, a–z).\r\nEach decoded message brings you closer to the final treasure!","description_html":"\u003cdiv style = \"text-align: start; line-height: 20.44px; 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: none; white-space: normal; \"\u003e\u003cdiv style=\"block-size: 132px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 408px 66px; transform-origin: 408px 66px; 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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEmerging from the Maze of Numbers, you find a tablet etched with symbols and letters — an \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eAncient Script\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e!\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: 385px 21px; text-align: left; transform-origin: 385px 21px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe message is hidden among strange symbols. To uncover it, you must \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003ekeep only alphabetic characters\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e and remove everything else.\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string or character array \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003es\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e, return a new string \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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-family: Menlo, Monaco, Consolas, \u0026quot;Courier New\u0026quot;, monospace; \"\u003edecoded\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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e containing only the letters (A–Z, a–z).\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: 385px 10.5px; text-align: left; transform-origin: 385px 10.5px; white-space-collapse: preserve; 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: 0px 0px; transform-origin: 0px 0px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eEach decoded message brings you closer to the final treasure!\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = decodeScript(s)\r\n  y = x;\r\nend","test_suite":"%%\r\ns = 'M@A#T$L%A^B!';\r\ny_correct = 'MATLAB';\r\nassert(isequal(decodeScript(s),y_correct))\r\n","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":4953963,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":69,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2025-10-21T09:36:18.000Z","updated_at":"2026-03-10T13:20:48.000Z","published_at":"2025-10-21T09:36:18.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eEmerging from the Maze of Numbers, you find a tablet etched with symbols and letters — an \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eAncient Script\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\u003eThe message is hidden among strange symbols. To uncover it, you must \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ekeep only alphabetic characters\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e and remove everything else.\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\u003eGiven a string or character array \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\u003es\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, return a new string \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\u003edecoded\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e containing only the letters (A–Z, a–z).\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\u003eEach decoded message brings you closer to the final treasure!\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":171,"title":"Reverse the Words (not letters) of a String","description":"*Description*\r\n\r\nChange the words of a string such that the words appear in reverse order. You may assume that the string is a number of words split by a single space character. The only characters in the input are letters and spaces.\r\n\r\n*Example*\r\n\r\n   input = 'Will the ecological jail rule outside the tear';\r\n   output = 'tear the outside rule jail ecological the Will';","description_html":"\u003cp\u003e\u003cb\u003eDescription\u003c/b\u003e\u003c/p\u003e\u003cp\u003eChange the words of a string such that the words appear in reverse order. You may assume that the string is a number of words split by a single space character. The only characters in the input are letters and spaces.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e   input = 'Will the ecological jail rule outside the tear';\r\n   output = 'tear the outside rule jail ecological the Will';\u003c/pre\u003e","function_template":"function s2 = reverseWords(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\nx = 'Will the ecological jail rule outside the tear';\r\ny_correct = 'tear the outside rule jail ecological the Will';\r\nassert(isequal(reverseWords(x),y_correct))\r\n\r\n%%\r\nx = 'That computer programmer kept the room warm';\r\ny_correct = 'warm room the kept programmer computer That';\r\nassert(isequal(reverseWords(x),y_correct))\r\n\r\n%%\r\nx = 'trivial';\r\ny_correct = 'trivial';\r\nassert(isequal(reverseWords(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":6,"comments_count":1,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":472,"test_suite_updated_at":"2012-01-30T05:18:55.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-01-30T05:15:30.000Z","updated_at":"2026-03-14T06:25:28.000Z","published_at":"2012-01-30T05:19:22.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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eDescription\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\u003eChange the words of a string such that the words appear in reverse order. You may assume that the string is a number of words split by a single space character. The only characters in the input are letters and spaces.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[   input = 'Will the ecological jail rule outside the tear';\\n   output = 'tear the outside rule jail ecological the Will';]]\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":44358,"title":"I Plead the Fifth","description":"Write a function to provide a yes or no answer to the input string. However, it must plead the 5th amendment (return an empty string) if the number five or any variation thereof (e.g., fifth, fifty, fifteen, 5) is within the input string.","description_html":"\u003cp\u003eWrite a function to provide a yes or no answer to the input string. However, it must plead the 5th amendment (return an empty string) if the number five or any variation thereof (e.g., fifth, fifty, fifteen, 5) is within the input string.\u003c/p\u003e","function_template":"function answer = I_plead_the_fifth(question)\r\n str = 'yes/no';\r\nend","test_suite":"%%\r\nquestion = 'Are you the fifth child?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Were you at home on the night of 24 Oct 1974?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))\r\n\r\n%%\r\nquestion = 'Did you go to work on 15 Oct 1955?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Did you go to the bowling alley last week?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))\r\n\r\n%%\r\nquestion = 'Do you like bread?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))\r\n\r\n%%\r\nquestion = 'Are there five fingers on your right hand?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Do you like pumpkins?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))\r\n\r\n%%\r\nquestion = 'Do you have fifteen siblings?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Do two quarters equal fifty cents?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Do you own five dogs?';\r\nassert(isempty(I_plead_the_fifth(question)))\r\n\r\n%%\r\nquestion = 'Is my name Harry?';\r\nassert(strcmpi(I_plead_the_fifth(question),'yes') || ...\r\n    strcmpi(I_plead_the_fifth(question),'no'))","published":true,"deleted":false,"likes_count":6,"comments_count":0,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":427,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-10-03T17:12:42.000Z","updated_at":"2026-03-22T03:30:09.000Z","published_at":"2017-10-16T01:45:09.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eWrite a function to provide a yes or no answer to the input string. However, it must plead the 5th amendment (return an empty string) if the number five or any variation thereof (e.g., fifth, fifty, fifteen, 5) is within the input string.\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":43077,"title":"Put all numbers in a string inside square brackets","description":"Examples: \r\n\r\n  'left3down2' -\u003e 'left[3]down[2]'\r\n\r\n  'fiat500' -\u003e 'fiat[500]'","description_html":"\u003cp\u003eExamples:\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e'left3down2' -\u0026gt; 'left[3]down[2]'\r\n\u003c/pre\u003e\u003cpre class=\"language-matlab\"\u003e'fiat500' -\u0026gt; 'fiat[500]'\r\n\u003c/pre\u003e","function_template":"function y = nestedNums(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'left3down2';\r\ny_correct = 'left[3]down[2]';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = 'fiat500';\r\ny_correct = 'fiat[500]';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = 'no numbers here';\r\ny_correct = 'no numbers here';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = '1234567890';\r\ny_correct = '[1234567890]';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = 'var1 = 20; var2 = 47; var3 = 59;';\r\ny_correct = 'var[1] = [20]; var[2] = [47]; var[3] = [59];';\r\nassert(strcmp(nestedNums(x),y_correct))\r\n\r\n%%\r\nx = '14et38z1n541z8ne';\r\ny_correct = '[14]et[38]z[1]n[541]z[8]ne';\r\nassert(strcmp(nestedNums(x),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":1,"created_by":29461,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2016-10-19T21:22:17.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2016-10-05T21:23:36.000Z","updated_at":"2026-01-02T17:46:16.000Z","published_at":"2016-10-05T21:23:36.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\u003eExamples:\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['left3down2' -\u003e 'left[3]down[2]'\\n\\n'fiat500' -\u003e 'fiat[500]']]\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":877,"title":"What is Title of Cody Challenge 42?","description":"Given a Cody Challenge number return its Title.\r\n\r\n*Input:* Cody Challenge Number\r\n\r\n*Output:* Title of the Cody Challenge\r\n\r\n  1 'Times 2 - START HERE'  \r\n  2 'Make the vector [1 2 3 4 5 6 7 8 9 10]' \r\n110 'Make an N-dimensional Multiplication Table'\r\n808 'Hamming Weight - Fast'  \r\n\r\n\r\nFor my methods this was non-trivial due to hyperlink issues.\r\n\r\n Warning:What \"you\" may see is not what you \"get\"\r\n Can anyone \"get\" the title to challenge 4?\r\n My method faces many blocked challenge numbers.\r\n\r\n(I retain the right to add cases if hard coded answers are invoked and become the leading solution size)","description_html":"\u003cp\u003eGiven a Cody Challenge number return its Title.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e Cody Challenge Number\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e Title of the Cody Challenge\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1 'Times 2 - START HERE'  \r\n2 'Make the vector [1 2 3 4 5 6 7 8 9 10]' \r\n110 'Make an N-dimensional Multiplication Table'\r\n808 'Hamming Weight - Fast'  \r\n\u003c/pre\u003e\u003cp\u003eFor my methods this was non-trivial due to hyperlink issues.\u003c/p\u003e\u003cpre\u003e Warning:What \"you\" may see is not what you \"get\"\r\n Can anyone \"get\" the title to challenge 4?\r\n My method faces many blocked challenge numbers.\u003c/pre\u003e\u003cp\u003e(I retain the right to add cases if hard coded answers are invoked and become the leading solution size)\u003c/p\u003e","function_template":"function Title = Cody_Title(n)\r\n  Title='Good Luck';\r\nend","test_suite":"%%\r\nn = 1;\r\nTitle_correct = 'Times 2 - START HERE';\r\nassert(strcmp(Cody_Title(n),Title_correct))\r\n%%\r\nn = 2;\r\nTitle_correct = 'Make the vector [1 2 3 4 5 6 7 8 9 10]';\r\nassert(strcmp(Cody_Title(n),Title_correct))\r\n%%\r\nn = 110;\r\nTitle_correct = 'Make an N-dimensional Multiplication Table';\r\n% This problem hurts my head\r\nassert(strcmp(Cody_Title(n),Title_correct))\r\n%%\r\nn = 808;\r\nTitle_correct = 'Hamming Weight - Fast';\r\nassert(strcmp(Cody_Title(n),Title_correct))","published":true,"deleted":false,"likes_count":6,"comments_count":3,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":32,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2012-08-04T14:40:09.000Z","updated_at":"2025-12-27T16:14:18.000Z","published_at":"2012-08-04T16:25:31.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 Cody Challenge number return its Title.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Cody Challenge Number\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e Title of the Cody Challenge\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[1 'Times 2 - START HERE'  \\n2 'Make the vector [1 2 3 4 5 6 7 8 9 10]' \\n110 'Make an N-dimensional Multiplication Table'\\n808 'Hamming Weight - Fast']]\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\u003eFor my methods this was non-trivial due to hyperlink issues.\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[ Warning:What \\\"you\\\" may see is not what you \\\"get\\\"\\n Can anyone \\\"get\\\" the title to challenge 4?\\n My method faces many blocked challenge numbers.]]\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\u003e(I retain the right to add cases if hard coded answers are invoked and become the leading solution size)\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":2500,"title":"Text Processing - New","description":"Derived from problem 2440.\r\n\r\nA string containing several sentences are given as input. If any sentence contains the word 'great' more than twice, replace every second 'great' of that sentence with the word 'awesome'.\r\n\r\nExample:\r\n\r\nInput = 'Sheldon, Penny, Leonard and Raj are great and great and great and great receptively. Wolowitz is just a great jerk';\r\n\r\nOutput = 'Sheldon, Penny, Leonard and Raj are great and awesome and great and awesome receptively. Wolowitz is just a great jerk';","description_html":"\u003cp\u003eDerived from problem 2440.\u003c/p\u003e\u003cp\u003eA string containing several sentences are given as input. If any sentence contains the word 'great' more than twice, replace every second 'great' of that sentence with the word 'awesome'.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cp\u003eInput = 'Sheldon, Penny, Leonard and Raj are great and great and great and great receptively. Wolowitz is just a great jerk';\u003c/p\u003e\u003cp\u003eOutput = 'Sheldon, Penny, Leonard and Raj are great and awesome and great and awesome receptively. Wolowitz is just a great jerk';\u003c/p\u003e","function_template":"function y = stringGreat(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx =  'Sheldon, Penny, Leonard and Raj are great and great and great and great receptively. Wolowitz is just a great jerk';\r\ny_correct =  'Sheldon, Penny, Leonard and Raj are great and awesome and great and awesome receptively. Wolowitz is just a great jerk';\r\nassert(isequal(stringGreat(x),y_correct))\r\n\r\n\r\n%%\r\nx =  'great great great. great great. great'\r\ny_correct =  'great awesome great. great awesome. great'\r\nassert(isequal(stringGreat(x),y_correct))\r\n\r\n\r\n%%\r\nx =  'Greatness is great gift. Great news'\r\ny_correct =  x;\r\nassert(isequal(stringGreat(x),y_correct))\r\n\r\n\r\n%%\r\nx =  'Being great implies that you must think like other great people and that is basically done to make sure that the proverb great minds think alike is correct and that is great. Probably that is not a great example I came up with';\r\n\r\ny_correct =  'Being great implies that you must think like other awesome people and that is basically done to make sure that the proverb great minds think alike is correct and that is awesome. Probably that is not a great example I came up with';\r\n\r\nassert(isequal(stringGreat(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":7,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":14,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2014-08-09T19:48:47.000Z","updated_at":"2014-08-09T19:49:40.000Z","published_at":"2014-08-09T19:48:47.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eDerived from problem 2440.\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\u003eA string containing several sentences are given as input. If any sentence contains the word 'great' more than twice, replace every second 'great' of that sentence with the word 'awesome'.\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\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\u003cw:jc w:val=\\\"left\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eInput = 'Sheldon, Penny, Leonard and Raj are great and great and great and great receptively. Wolowitz is just a great jerk';\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\u003eOutput = 'Sheldon, Penny, Leonard and Raj are great and awesome and great and awesome receptively. Wolowitz is just a great jerk';\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":269,"title":"Find Rotated Substring","description":"Given a string s1, find if a rotated version of s1 is present in a second string s2.\r\nFor example, rotated version of some strings are:\r\n\"matlabcentral\" =\u003e \"atlabcentralm\" =\u003e .. =\u003e \"centralmatlab\" etc.\r\nSo, if\r\n    s1 = 'matlabcentral';\r\n    s2 = 'thecentralmatlab';\r\nthen the result is true.","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: 192.867px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 96.4333px; transform-origin: 407px 96.4333px; 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: 250px 8px; transform-origin: 250px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string s1, find if a rotated version of s1 is present in a second string s2.\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: 155px 8px; transform-origin: 155px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example, rotated version of some strings are:\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: 196px 8px; transform-origin: 196px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e\"matlabcentral\" =\u0026gt; \"atlabcentralm\" =\u0026gt; .. =\u0026gt; \"centralmatlab\" etc.\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: 16px 8px; transform-origin: 16px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eSo, if\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 40.8667px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 20.4333px; transform-origin: 404px 20.4333px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 100px 8.5px; tab-size: 4; transform-origin: 100px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 36px 8.5px; transform-origin: 36px 8.5px; \"\u003e    s1 = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 60px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 60px 8.5px; \"\u003e'matlabcentral'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 112px 8.5px; tab-size: 4; transform-origin: 112px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 36px 8.5px; transform-origin: 36px 8.5px; \"\u003e    s2 = \u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 72px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 72px 8.5px; \"\u003e'thecentralmatlab'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e;\u003c/span\u003e\u003c/span\u003e\u003c/div\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: 10px; margin-bottom: 9px; margin-inline-end: 10px; margin-inline-start: 4px; margin-left: 4px; margin-right: 10px; margin-top: 10px; perspective-origin: 384px 10.5px; text-align: left; transform-origin: 384px 10.5px; white-space: pre-wrap; margin-left: 4px; margin-top: 10px; 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: 69px 8px; transform-origin: 69px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003ethen the result is true.\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = isRotatedStrPresent(s1,s2)\r\n  y = s1 == s2;\r\nend","test_suite":"%%\r\ns1 = 'matlabcentral';\r\ns2 = 'thecentralmatlab';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'altabcentralm';\r\ns2 = 'thecentralmatlab';\r\ny_correct = false;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'cooldrinks';\r\ns2 = 'somecoolerdrinks';\r\ny_correct = false;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'controlsystem';\r\ns2 = 'asystemcontrol';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'controlsystem';\r\ns2 = 'contorlsystem';\r\ny_correct = false;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'codyiscool';\r\ns2 = 'coolcodyis';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'abc';\r\ns2 = 'xyz';\r\ny_correct = false;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'Elements';\r\ns2 = 'Elements';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))\r\n%%\r\ns1 = 'quickbrownfoxjumpsoverlazydog';\r\ns2 = 'jumpsoverlazydogquickbrownfoxdoes';\r\ny_correct = true;\r\nassert(isequal(isRotatedStrPresent(s1,s2),y_correct))","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":264,"edited_by":223089,"edited_at":"2023-05-19T07:53:48.000Z","deleted_by":null,"deleted_at":null,"solvers_count":242,"test_suite_updated_at":"2023-05-19T07:53:48.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-02-06T13:56:24.000Z","updated_at":"2026-03-12T20:46:43.000Z","published_at":"2012-02-06T14:50:07.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eGiven a string s1, find if a rotated version of s1 is present in a second string s2.\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\u003eFor example, rotated version of some strings are:\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\u003e\\\"matlabcentral\\\" =\u0026gt; \\\"atlabcentralm\\\" =\u0026gt; .. =\u0026gt; \\\"centralmatlab\\\" etc.\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\u003eSo, if\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[    s1 = 'matlabcentral';\\n    s2 = 'thecentralmatlab';]]\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\u003ethen the result is true.\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":42370,"title":"The Python Challenge, Level 1: Decode strings","description":"This problem is based on \u003chttp://www.pythonchallenge.com/pc/def/map.html Level 1 of The Python Challenge\u003e, which is just a series of puzzles created by Nadav Samet to help folks have fun while learning the Python programming language. Obviously, this Cody problem is for MATLAB, but feel free to think about how you might solve the problem in other languages!\r\n\r\nYour task is to decode an input string using the following hints:\r\n\r\n* K --\u003e M\r\n* O --\u003e Q\r\n* E --\u003e G","description_html":"\u003cp\u003eThis problem is based on \u003ca href = \"http://www.pythonchallenge.com/pc/def/map.html\"\u003eLevel 1 of The Python Challenge\u003c/a\u003e, which is just a series of puzzles created by Nadav Samet to help folks have fun while learning the Python programming language. Obviously, this Cody problem is for MATLAB, but feel free to think about how you might solve the problem in other languages!\u003c/p\u003e\u003cp\u003eYour task is to decode an input string using the following hints:\u003c/p\u003e\u003cul\u003e\u003cli\u003eK --\u0026gt; M\u003c/li\u003e\u003cli\u003eO --\u0026gt; Q\u003c/li\u003e\u003cli\u003eE --\u0026gt; G\u003c/li\u003e\u003c/ul\u003e","function_template":"function s = strdecode(str)\r\n  s = str;\r\nend","test_suite":"%%\r\nstr = 'G fmnc wms bgbl''r rpylqjyrc gr zw fylb. Rfyr''q ufyr amknsrcpq ypc dmp. Bmgle gr zw fylb gq glcddgagclr ylb rfyr''q ufw rfgq rcvr gq qm jmle. Sqgle pcecvn gq pcamkkclbcb.';\r\ns_correct = 'I hope you didn''t translate it by hand. That''s what computers are for. Doing it by hand is inefficient and that''s why this text is so long. Using regexp is recommended.';\r\nassert(isequal(strdecode(str),s_correct))\r\n\r\n%%\r\nstr = 'KYRJYZ gq yucqmkc!';\r\ns_correct = 'MATLAB is awesome!';\r\nassert(isequal(strdecode(str),s_correct))\r\n\r\n%%\r\nstr = 'dmm zyp zyx osv';\r\ns_correct = 'foo bar baz qux';\r\nassert(isequal(strdecode(str),s_correct))\r\n\r\n%%\r\np = ' .?!'';:';\r\nfor ii=1:100\r\n  str = '';\r\n  for jj=1:100\r\n    r = rand;\r\n    if r\u003c0.4\r\n      str(jj) = randi([65 90]);\r\n    elseif r\u003c0.8\r\n      str(jj) = randi([97 122]);\r\n    else\r\n      str(jj) = p(randi(7));\r\n    end\r\n  end\r\n  s_correct = regexprep(strdecode(str),'([C-Zc-z])*([ABab])*','${char($1-2)}${char($2+24)}');\r\nassert(isequal(str,s_correct))\r\nend\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":0,"created_by":4793,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":30,"test_suite_updated_at":"2015-06-13T04:32:14.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2015-06-13T03:57:22.000Z","updated_at":"2025-12-29T15:05:02.000Z","published_at":"2015-06-13T04:13:53.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\u003eThis problem is based on\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://www.pythonchallenge.com/pc/def/map.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eLevel 1 of The Python Challenge\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e, which is just a series of puzzles created by Nadav Samet to help folks have fun while learning the Python programming language. Obviously, this Cody problem is for MATLAB, but feel free to think about how you might solve the problem in other languages!\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\u003eYour task is to decode an input string using the following hints:\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\u003eK --\u0026gt; M\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\u003eO --\u0026gt; Q\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\u003eE --\u0026gt; G\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":530,"title":"convert?","description":"* Given a string containing a number followed by pounds or kgs, for example:\r\n* 'Billy lost 22 pounds in four weeks.'\r\n* 'Maria gained 10 kgs in 18 months.'\r\n* If the unit was pounds, that amount should be converted to nearest rounded kgs:\r\n* 'Billy lost 10 kgs in four weeks.'\r\n* If the unit was kgs, that amount should be converted to nearest rounded pounds:\r\n* 'Maria gained 22 pounds in 18 months.'","description_html":"\u003cul\u003e\u003cli\u003eGiven a string containing a number followed by pounds or kgs, for example:\u003c/li\u003e\u003cli\u003e'Billy lost 22 pounds in four weeks.'\u003c/li\u003e\u003cli\u003e'Maria gained 10 kgs in 18 months.'\u003c/li\u003e\u003cli\u003eIf the unit was pounds, that amount should be converted to nearest rounded kgs:\u003c/li\u003e\u003cli\u003e'Billy lost 10 kgs in four weeks.'\u003c/li\u003e\u003cli\u003eIf the unit was kgs, that amount should be converted to nearest rounded pounds:\u003c/li\u003e\u003cli\u003e'Maria gained 22 pounds in 18 months.'\u003c/li\u003e\u003c/ul\u003e","function_template":"function  converted = convert(this)\r\n  converted = 'Billy lost 10 kgs in four weeks.';\r\nend","test_suite":"%%\r\nassert(isequal(convert('Billy lost 22 pounds in four weeks.'),'Billy lost 10 kgs in four weeks.'))\r\n%%\r\nassert(isequal(convert('Maria gained 10 kgs in four months.'),'Maria gained 22 pounds in four months.'))\r\n%%\r\nassert(isequal(convert('Billy lost 44 pounds in 44 weeks.'),'Billy lost 20 kgs in 44 weeks.'))\r\n%%\r\nassert(isequal(convert('Maria gained 20 kgs in 20 months.'),'Maria gained 44 pounds in 20 months.'))\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":1,"created_by":166,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":43,"test_suite_updated_at":"2012-03-26T07:11:46.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-03-26T07:07:32.000Z","updated_at":"2025-08-12T11:38:48.000Z","published_at":"2012-03-26T07:07:32.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\u003eGiven a string containing a number followed by pounds or kgs, for example:\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\u003e'Billy lost 22 pounds in four weeks.'\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\u003e'Maria gained 10 kgs in 18 months.'\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\u003eIf the unit was pounds, that amount should be converted to nearest rounded kgs:\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\u003e'Billy lost 10 kgs in four weeks.'\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\u003eIf the unit was kgs, that amount should be converted to nearest rounded pounds:\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\u003e'Maria gained 22 pounds in 18 months.'\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":43658,"title":"When Was That Goal Scored?","description":"We want to find out when the goals were scored in a particular soccer game. For each game, we are given a \"Goal Event Data\" XML string from a soccer database. Your job is to pick out the \"Elapsed Time\" number for each goal. Return the numbers for each goal as a column vector of double precision numbers.\r\n\r\nThis translates to finding the number between the \"\u003celapsed\u003e\" tags.\r\n\r\n*Example*\r\n\r\nGiven this input\r\n\r\n ged = '\u003cgoal\u003e\u003cvalue\u003e\u003celapsed\u003e22\u003c/elapsed\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003c/value\u003e\u003c/goal\u003e'\r\n\r\nyou should return the number 22.\r\n\r\nNote that you must return the number 22 and not the string.\r\n\r\n*Feature Tip* \r\n\r\n\u003chttps://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026startrelease=R2016b\u0026endrelease=R2016b\u0026groupby=release\u0026sortby=descending R2016b\u003e introduces string arrays and text manipulation functions which can help. To learn more see \u003chttps://www.mathworks.com/help/matlab/characters-and-strings.html MATLAB Characters and Strings\u003e.","description_html":"\u003cp\u003eWe want to find out when the goals were scored in a particular soccer game. For each game, we are given a \"Goal Event Data\" XML string from a soccer database. Your job is to pick out the \"Elapsed Time\" number for each goal. Return the numbers for each goal as a column vector of double precision numbers.\u003c/p\u003e\u003cp\u003eThis translates to finding the number between the \"\u0026lt;elapsed\u0026gt;\" tags.\u003c/p\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cp\u003eGiven this input\u003c/p\u003e\u003cpre\u003e ged = '\u0026lt;goal\u0026gt;\u0026lt;value\u0026gt;\u0026lt;elapsed\u0026gt;22\u0026lt;/elapsed\u0026gt;\u0026lt;subtype\u0026gt;header\u0026lt;/subtype\u0026gt;\u0026lt;/value\u0026gt;\u0026lt;/goal\u0026gt;'\u003c/pre\u003e\u003cp\u003eyou should return the number 22.\u003c/p\u003e\u003cp\u003eNote that you must return the number 22 and not the string.\u003c/p\u003e\u003cp\u003e\u003cb\u003eFeature Tip\u003c/b\u003e\u003c/p\u003e\u003cp\u003e\u003ca href = \"https://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026startrelease=R2016b\u0026endrelease=R2016b\u0026groupby=release\u0026sortby=descending\"\u003eR2016b\u003c/a\u003e introduces string arrays and text manipulation functions which can help. To learn more see \u003ca href = \"https://www.mathworks.com/help/matlab/characters-and-strings.html\"\u003eMATLAB Characters and Strings\u003c/a\u003e.\u003c/p\u003e","function_template":"function elapsed = getElapsedTime(ged)\r\n    elapsed = 0;\r\nend\r\n","test_suite":"%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003celapsed\u003e47\u003c/elapsed\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [47];\r\nassert(isequal(elapsed,elapsed_correct))\r\n\r\n%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e406\u003c/event_incident_typefk\u003e\u003celapsed\u003e22\u003c/elapsed\u003e\u003cplayer2\u003e38807\u003c/player2\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003cplayer1\u003e37799\u003c/player1\u003e\u003csortorder\u003e5\u003c/sortorder\u003e\u003cteam\u003e10261\u003c/team\u003e\u003cid\u003e378998\u003c/id\u003e\u003cn\u003e295\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e393\u003c/event_incident_typefk\u003e\u003celapsed\u003e24\u003c/elapsed\u003e\u003cplayer2\u003e24154\u003c/player2\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cplayer1\u003e24148\u003c/player1\u003e\u003csortorder\u003e4\u003c/sortorder\u003e\u003cteam\u003e10260\u003c/team\u003e\u003cid\u003e379019\u003c/id\u003e\u003cn\u003e298\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [22;24];\r\nassert(isequal(elapsed,elapsed_correct))\r\n\r\n%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e406\u003c/event_incident_typefk\u003e\u003celapsed\u003e73\u003c/elapsed\u003e\u003cplayer2\u003e25668\u003c/player2\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003cplayer1\u003e38755\u003c/player1\u003e\u003csortorder\u003e2\u003c/sortorder\u003e\u003cteam\u003e10194\u003c/team\u003e\u003cid\u003e465096\u003c/id\u003e\u003cn\u003e321\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [73];\r\nassert(isequal(elapsed,elapsed_correct))\r\n\r\n%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e393\u003c/event_incident_typefk\u003e\u003celapsed\u003e3\u003c/elapsed\u003e\u003cplayer2\u003e24635\u003c/player2\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cplayer1\u003e37139\u003c/player1\u003e\u003csortorder\u003e3\u003c/sortorder\u003e\u003cteam\u003e8650\u003c/team\u003e\u003cid\u003e468555\u003c/id\u003e\u003cn\u003e239\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003eo\u003c/comment\u003e\u003cstats\u003e\u003cowngoals\u003e1\u003c/owngoals\u003e\u003c/stats\u003e\u003cevent_incident_typefk\u003e115\u003c/event_incident_typefk\u003e\u003celapsed\u003e69\u003c/elapsed\u003e\u003cplayer1\u003e30617\u003c/player1\u003e\u003csortorder\u003e3\u003c/sortorder\u003e\u003cteam\u003e8650\u003c/team\u003e\u003cid\u003e468934\u003c/id\u003e\u003cn\u003e304\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003eo\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed_plus\u003e1\u003c/elapsed_plus\u003e\u003cevent_incident_typefk\u003e393\u003c/event_incident_typefk\u003e\u003celapsed\u003e90\u003c/elapsed\u003e\u003cplayer2\u003e23949\u003c/player2\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cplayer1\u003e40755\u003c/player1\u003e\u003csortorder\u003e2\u003c/sortorder\u003e\u003cteam\u003e8586\u003c/team\u003e\u003cid\u003e469035\u003c/id\u003e\u003cn\u003e328\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [3; 69; 90];\r\nassert(isequal(elapsed,elapsed_correct))\r\n\r\n%%\r\nged = '\u003cgoal\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e11\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8472\u003c/team\u003e\u003cid\u003e507018\u003c/id\u003e\u003cn\u003e250\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e18\u003c/elapsed\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003cteam\u003e8559\u003c/team\u003e\u003cid\u003e507106\u003c/id\u003e\u003cn\u003e255\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e21\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8559\u003c/team\u003e\u003cid\u003e507142\u003c/id\u003e\u003cn\u003e259\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003edg\u003c/comment\u003e\u003celapsed\u003e30\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8472\u003c/team\u003e\u003cid\u003e507259\u003c/id\u003e\u003cn\u003e148\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003edg\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e39\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8559\u003c/team\u003e\u003cid\u003e507390\u003c/id\u003e\u003cn\u003e278\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003cvalue\u003e\u003ccomment\u003en\u003c/comment\u003e\u003cstats\u003e\u003cgoals\u003e1\u003c/goals\u003e\u003cshoton\u003e1\u003c/shoton\u003e\u003c/stats\u003e\u003celapsed\u003e55\u003c/elapsed\u003e\u003csubtype\u003eshot\u003c/subtype\u003e\u003cteam\u003e8559\u003c/team\u003e\u003cid\u003e507734\u003c/id\u003e\u003cn\u003e295\u003c/n\u003e\u003ctype\u003egoal\u003c/type\u003e\u003cgoal_type\u003en\u003c/goal_type\u003e\u003c/value\u003e\u003c/goal\u003e';\r\nelapsed = getElapsedTime(ged);\r\nelapsed_correct = [11; 18; 21; 30; 39; 55];\r\nassert(isequal(elapsed,elapsed_correct))\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":2,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":124,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":16,"created_at":"2016-11-17T17:32:24.000Z","updated_at":"2026-03-24T21:01:26.000Z","published_at":"2016-11-17T17:46:42.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\u003eWe want to find out when the goals were scored in a particular soccer game. For each game, we are given a \\\"Goal Event Data\\\" XML string from a soccer database. Your job is to pick out the \\\"Elapsed Time\\\" number for each goal. Return the numbers for each goal as a column vector of double precision numbers.\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\u003eThis translates to finding the number between the \\\"\u0026lt;elapsed\u0026gt;\\\" tags.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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\u003eGiven this input\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[ ged = '\u003cgoal\u003e\u003cvalue\u003e\u003celapsed\u003e22\u003c/elapsed\u003e\u003csubtype\u003eheader\u003c/subtype\u003e\u003c/value\u003e\u003c/goal\u003e']]\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\u003eyou should return the number 22.\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\u003eNote that you must return the number 22 and not the string.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eFeature Tip\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:hyperlink w:docLocation=\\\"https://www.mathworks.com/help/matlab/release-notes.html?rntext=\u0026amp;startrelease=R2016b\u0026amp;endrelease=R2016b\u0026amp;groupby=release\u0026amp;sortby=descending\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eR2016b\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e introduces string arrays and text manipulation functions which can help. To learn more see\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=\\\"https://www.mathworks.com/help/matlab/characters-and-strings.html\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eMATLAB Characters and Strings\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":2368,"title":"I want eval","description":"A valid MATLAB statement containing a definition of a vector is passed as a string S. Determine the length of the vector.\r\n\r\nInput: S='vec=1:10;';\r\nOutput=10\r\n\r\nExplanation: if you execute eval(S), a vector vec of length 10 will be generated.\r\nSimilarly,\r\n\r\nInput: S='a=[1 2 3 4 5];'\r\nOutput=5\r\n\r\nInput: S='a=ones(1,10);';\r\nOutput=10\r\n\r\n\r\nInput: S='a=[];';\r\nOutput=0;","description_html":"\u003cp\u003eA valid MATLAB statement containing a definition of a vector is passed as a string S. Determine the length of the vector.\u003c/p\u003e\u003cp\u003eInput: S='vec=1:10;';\r\nOutput=10\u003c/p\u003e\u003cp\u003eExplanation: if you execute eval(S), a vector vec of length 10 will be generated.\r\nSimilarly,\u003c/p\u003e\u003cp\u003eInput: S='a=[1 2 3 4 5];'\r\nOutput=5\u003c/p\u003e\u003cp\u003eInput: S='a=ones(1,10);';\r\nOutput=10\u003c/p\u003e\u003cp\u003eInput: S='a=[];';\r\nOutput=0;\u003c/p\u003e","function_template":"function y = your_fcn_name(x)\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'a=[1 2 3 4 5];';\r\ny_correct = 5;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=ones(1,10);';\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x),y_correct));\r\n\r\n%%\r\nx = 'a=zeros(0,0);';\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=1:10';\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=1:2:10;';\r\ny_correct = 5;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=[];';\r\ny_correct = 0;\r\nassert(isequal(your_fcn_name(x),y_correct))\r\n\r\n%%\r\nx = 'a=ones(10,1);';\r\ny_correct = 10;\r\nassert(isequal(your_fcn_name(x),y_correct));","published":true,"deleted":false,"likes_count":2,"comments_count":2,"created_by":17203,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":25,"test_suite_updated_at":"2014-06-17T21:11:05.000Z","rescore_all_solutions":true,"group_id":1,"created_at":"2014-06-17T20:57:22.000Z","updated_at":"2014-06-17T21:11:05.000Z","published_at":"2014-06-17T20:58:00.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eA valid MATLAB statement containing a definition of a vector is passed as a string S. Determine the length of the vector.\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\u003eInput: S='vec=1:10;'; Output=10\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\u003eExplanation: if you execute eval(S), a vector vec of length 10 will be generated. Similarly,\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\u003eInput: S='a=[1 2 3 4 5];' Output=5\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\u003eInput: S='a=ones(1,10);'; Output=10\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\u003eInput: S='a=[];'; Output=0;\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":1376,"title":"Find names/words that start and end with the same letter.","description":"Find names/words (from a string) that start and end with the same letter.\r\n\r\n* Case-insensitive.\r\n* If a name/word is not at the end of the string, it can be followed by a white-space or a comma.\r\n* Names/words contain only letters or dashes.\r\n* Underscores are *NOT* considered as letters. Words separated by underscores count as distinct words, e.g. in |'NAN_CONST'| the |'NAN'| is matched.\r\n* Words are at least two letters long, so e.g. |'a'| is not matched.\r\n\r\nExample:\r\n\r\n in  = 'Cedric loves regular expressions'\r\n out = {'Cedric', 'regular'}\r\n\r\n","description_html":"\u003cp\u003eFind names/words (from a string) that start and end with the same letter.\u003c/p\u003e\u003cul\u003e\u003cli\u003eCase-insensitive.\u003c/li\u003e\u003cli\u003eIf a name/word is not at the end of the string, it can be followed by a white-space or a comma.\u003c/li\u003e\u003cli\u003eNames/words contain only letters or dashes.\u003c/li\u003e\u003cli\u003eUnderscores are \u003cb\u003eNOT\u003c/b\u003e considered as letters. Words separated by underscores count as distinct words, e.g. in \u003ctt\u003e'NAN_CONST'\u003c/tt\u003e the \u003ctt\u003e'NAN'\u003c/tt\u003e is matched.\u003c/li\u003e\u003cli\u003eWords are at least two letters long, so e.g. \u003ctt\u003e'a'\u003c/tt\u003e is not matched.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e in  = 'Cedric loves regular expressions'\r\n out = {'Cedric', 'regular'}\u003c/pre\u003e","function_template":"function output = getWordsSameStartEnd( inStr )\r\n  output = {inStr} ;\r\nend","test_suite":"%%\r\ninStr = 'Cedric loves regular expressions' ;\r\noutput_correct = {'Cedric', 'regular'} ;\r\nassert(isequal(getWordsSameStartEnd(inStr),output_correct))\r\n\r\n%%\r\ninStr = 'Single neuron Cedric, Anna-Maria, Andrei, a koala' ;\r\noutput_correct = {'neuron', 'Cedric', 'Anna-Maria'} ;\r\nassert(isequal(getWordsSameStartEnd(inStr),output_correct))\r\n\r\n%%\r\ninStr = '__dEdiCaTeD__, REGULAR_EXPRESSION.. Rotor-1 and abracadabra' ;\r\noutput_correct = { 'dEdiCaTeD', 'REGULAR', 'abracadabra'} ;\r\nassert(isequal(getWordsSameStartEnd(inStr),output_correct))\r\n\r\n","published":true,"deleted":false,"likes_count":2,"comments_count":3,"created_by":9862,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":38,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-03-23T02:12:12.000Z","updated_at":"2025-12-08T13:43:32.000Z","published_at":"2013-03-23T03:05:57.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\u003eFind names/words (from a string) that start and end with the same letter.\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\u003eCase-insensitive.\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\u003eIf a name/word is not at the end of the string, it can be followed by a white-space or a comma.\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\u003eNames/words contain only letters or dashes.\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\u003eUnderscores are\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNOT\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e considered as letters. Words separated by underscores count as distinct words, e.g. in\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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'NAN_CONST'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e the\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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'NAN'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is matched.\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\u003eWords are at least two letters long, so e.g.\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \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'a'\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e is not matched.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ in  = 'Cedric loves regular expressions'\\n out = {'Cedric', 'regular'}]]\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":35,"title":"Quote Doubler","description":"Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote character. \n \nIf there are n such occurrences in s1, then s2 will be n characters longer than s1.\n","description_html":"\u003cp\u003eGiven a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote character.\u003c/p\u003e\u003cp\u003eIf there are n such occurrences in s1, then s2 will be n characters longer than s1.\u003c/p\u003e","function_template":"function s2 = quote_doubler(s1)\n  s2 = s1\nend","test_suite":"%%\ns1 = 'He said ''Look over there!''';\ns2_correct = 'He said ''''Look over there!''''';\nassert(isequal(quote_doubler(s1),s2_correct))\n\n%%\ns1 = '''';\ns2_correct = '''''';\nassert(isequal(quote_doubler(s1),s2_correct))","published":true,"deleted":false,"likes_count":16,"comments_count":9,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3778,"test_suite_updated_at":"2012-01-18T01:00:21.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:21.000Z","updated_at":"2026-04-03T07:24:29.000Z","published_at":"2012-01-18T01:00:21.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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 s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote character.\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\u003eIf there are n such occurrences in s1, then s2 will be n characters longer than s1.\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":823,"title":"Find similar/related functions","description":"The help function can be useful for getting quick assistance on a particular function. For most built-in MATLAB functions, a portion of the help text lists similar or related functions (\"See also ...\").\r\nGiven a function name (string), return a cell array of the \"See also\" functions provided in the help text. If the input is not a real function or if no similar/related functions exist, return an empty cell array. The output should be all lowercase and in the order shown in the help text.\r\nExamples\r\nseeAlso('sum') = {'prod','cumsum','diff','accumarray','isfloat'}\r\n\r\nseeAlso('fake') = {};","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: 215.3px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 107.65px; transform-origin: 407px 107.65px; vertical-align: baseline; \"\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: 12.5px 8px; transform-origin: 12.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eThe\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: 2px 8px; transform-origin: 2px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e \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: 13.5px 8px; transform-origin: 13.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-style: italic; \"\u003ehelp\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: 352.5px 8px; transform-origin: 352.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003e function can be useful for getting quick assistance on a particular function. For most built-in MATLAB functions, a portion of the help text lists similar or related functions (\"See also ...\").\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: 382px 8px; transform-origin: 382px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a function name (string), return a cell array of the \"See also\" functions provided in the help text. If the input is not a real function or if no similar/related functions exist, return an empty cell array. The output should be all lowercase and in the order shown in the help text.\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: 33.5px 8px; transform-origin: 33.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"font-weight: 700; \"\u003eExamples\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgb(247, 247, 247); block-size: 61.3px; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; border-end-end-radius: 4px; border-end-start-radius: 4px; border-start-end-radius: 4px; border-start-start-radius: 4px; border-top-left-radius: 4px; border-top-right-radius: 4px; margin-block-end: 10px; margin-block-start: 10px; margin-bottom: 10px; margin-inline-end: 3px; margin-inline-start: 3px; margin-left: 3px; margin-right: 3px; margin-top: 10px; perspective-origin: 404px 30.65px; transform-origin: 404px 30.65px; margin-left: 3px; margin-top: 10px; margin-bottom: 10px; margin-right: 3px; \"\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 256px 8.5px; tab-size: 4; transform-origin: 256px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003eseeAlso(\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 20px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 20px 8.5px; \"\u003e'sum'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 20px 8.5px; transform-origin: 20px 8.5px; \"\u003e) = {\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e'prod'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 32px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 32px 8.5px; \"\u003e'cumsum'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e'diff'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 48px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 48px 8.5px; \"\u003e'accumarray'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e,\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 36px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 36px 8.5px; \"\u003e'isfloat'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 4px 8.5px; transform-origin: 4px 8.5px; \"\u003e}\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 0px 8.5px; tab-size: 4; transform-origin: 0px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; \"\u003e\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003cdiv style=\"background-color: rgba(0, 0, 0, 0); block-size: 20.4333px; border-bottom-left-radius: 0px; border-bottom-right-radius: 0px; border-end-end-radius: 0px; border-end-start-radius: 0px; border-inline-end-color: rgb(233, 233, 233); border-inline-end-style: solid; border-inline-end-width: 1px; border-inline-start-color: rgb(233, 233, 233); border-inline-start-style: solid; border-inline-start-width: 1px; border-left-color: rgb(233, 233, 233); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(233, 233, 233); border-right-style: solid; border-right-width: 1px; border-start-end-radius: 0px; border-start-start-radius: 0px; border-top-left-radius: 0px; border-top-right-radius: 0px; 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; min-block-size: 18px; min-height: 18px; padding-inline-start: 4px; padding-left: 4px; perspective-origin: 404px 10.2167px; transform-origin: 404px 10.2167px; white-space: nowrap; \"\u003e\u003cspan style=\"block-size: auto; border-inline-end-color: rgb(0, 0, 0); border-inline-end-style: none; border-inline-end-width: 0px; border-inline-start-color: rgb(0, 0, 0); border-inline-start-style: none; border-inline-start-width: 0px; border-left-color: rgb(0, 0, 0); border-left-style: none; border-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: none; border-right-width: 0px; display: inline; margin-inline-end: 45px; margin-right: 45px; min-block-size: 0px; min-height: 0px; padding-inline-start: 0px; padding-left: 0px; perspective-origin: 84px 8.5px; tab-size: 4; transform-origin: 84px 8.5px; unicode-bidi: normal; white-space: pre; margin-right: 45px; \"\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 32px 8.5px; transform-origin: 32px 8.5px; \"\u003eseeAlso(\u003c/span\u003e\u003cspan style=\"border-block-end-color: rgb(170, 4, 249); border-block-start-color: rgb(170, 4, 249); border-bottom-color: rgb(170, 4, 249); border-inline-end-color: rgb(170, 4, 249); border-inline-start-color: rgb(170, 4, 249); border-left-color: rgb(170, 4, 249); border-right-color: rgb(170, 4, 249); border-top-color: rgb(170, 4, 249); caret-color: rgb(170, 4, 249); color: rgb(170, 4, 249); column-rule-color: rgb(170, 4, 249); margin-inline-end: 0px; margin-right: 0px; outline-color: rgb(170, 4, 249); perspective-origin: 24px 8.5px; text-decoration-color: rgb(170, 4, 249); text-emphasis-color: rgb(170, 4, 249); transform-origin: 24px 8.5px; \"\u003e'fake'\u003c/span\u003e\u003cspan style=\"margin-inline-end: 0px; margin-right: 0px; perspective-origin: 28px 8.5px; transform-origin: 28px 8.5px; \"\u003e) = {};\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function sfcn = seeAlso(fcn)\r\n  sfcn = {};\r\nend","test_suite":"%%\r\nfcn = 'help';\r\nsfcn = {'doc','docsearch','matlabpath','which'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'regexp';\r\nsfcn = {'regexpi','regexprep','regexptranslate','strcmp','strfind', 'pattern'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'why';\r\nsfcn = {};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'who';\r\nsfcn = {'whos','clear','clearvars','save','load'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'which';\r\nsfcn = {'dir','help','who','what','exist','lookfor','fileparts' ,'mfilename' ,'path' ,'type'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'what';\r\nsfcn = {'dir','who','which','lookfor'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'bsxfun';\r\nsfcn = {'repmat','arrayfun'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'mat2cell';\r\nsfcn = {'cell2mat','num2cell'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'cell2mat';\r\nsfcn = {'mat2cell','num2cell'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'hankel';\r\nsfcn = {'toeplitz'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'uisetcolor';\r\nsfcn = {'inspect','propedit','uisetfont'};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'matlabiscool';\r\nsfcn = {};\r\nassert(isequal(seeAlso(fcn),sfcn))\r\n\r\n%%\r\nfcn = 'crazy';\r\nsfcn = {};\r\nassert(isequal(seeAlso(fcn),sfcn))","published":true,"deleted":false,"likes_count":0,"comments_count":9,"created_by":4793,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3,"test_suite_updated_at":"2022-03-08T17:07:58.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2012-07-10T21:28:00.000Z","updated_at":"2022-08-22T12:49:41.000Z","published_at":"2012-07-10T21:28:00.000Z","restored_at":null,"restored_by":null,"spam":null,"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\u003eThe\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e \u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:rPr\u003e\u003cw:i/\u003e\u003c/w:rPr\u003e\u003cw:t\u003ehelp\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e function can be useful for getting quick assistance on a particular function. For most built-in MATLAB functions, a portion of the help text lists similar or related functions (\\\"See also ...\\\").\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\u003eGiven a function name (string), return a cell array of the \\\"See also\\\" functions provided in the help text. If the input is not a real function or if no similar/related functions exist, return an empty cell array. The output should be all lowercase and in the order shown in the help 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:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples\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[seeAlso('sum') = {'prod','cumsum','diff','accumarray','isfloat'}\\n\\nseeAlso('fake') = {};]]\u003e\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":1915,"title":"GJam 2013 Veterans: Baby Height Prediction","description":"This Challenge is derived from \u003chttp://code.google.com/codejam/contest/2334486/dashboard#s=p1 GJam 2013 Veterans Baby Height\u003e. Only the first 82 of 5958 test cases are evaluated.\r\n\r\nThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex.  Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\" while a girl is -5\".  The range is +/- 4\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\r\n\r\n\r\n*Input:* str , String of Sex, Mom and Dad Height x'y\"\r\n\r\n*Output:* H , string of Predicted Height Range\r\n\r\n*Examples:* [str] [H]\r\n\r\n  B 5'11\" 6'2\"  spawns 5'11\" to 6'7\"\r\n  G 5'11\" 6'2\" spawns 5'6\" to 6'2\"\r\n  B 3'4\" 3'4\" spawns 3'3\" to 3'10\"\r\n  \r\n\r\n*Commentary:*\r\n\r\n  1) Provide input like fgetl per test case\r\n  2) 15 of 32 entrants completed this Challenge\r\n  3) This is a test of regexp and sprintf formatting (or just regexprep)","description_html":"\u003cp\u003eThis Challenge is derived from \u003ca href = \"http://code.google.com/codejam/contest/2334486/dashboard#s=p1\"\u003eGJam 2013 Veterans Baby Height\u003c/a\u003e. Only the first 82 of 5958 test cases are evaluated.\u003c/p\u003e\u003cp\u003eThe GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex.  Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\" while a girl is -5\".  The range is +/- 4\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\u003c/p\u003e\u003cp\u003e\u003cb\u003eInput:\u003c/b\u003e str , String of Sex, Mom and Dad Height x'y\"\u003c/p\u003e\u003cp\u003e\u003cb\u003eOutput:\u003c/b\u003e H , string of Predicted Height Range\u003c/p\u003e\u003cp\u003e\u003cb\u003eExamples:\u003c/b\u003e [str] [H]\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eB 5'11\" 6'2\"  spawns 5'11\" to 6'7\"\r\nG 5'11\" 6'2\" spawns 5'6\" to 6'2\"\r\nB 3'4\" 3'4\" spawns 3'3\" to 3'10\"\r\n\u003c/pre\u003e\u003cp\u003e\u003cb\u003eCommentary:\u003c/b\u003e\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e1) Provide input like fgetl per test case\r\n2) 15 of 32 entrants completed this Challenge\r\n3) This is a test of regexp and sprintf formatting (or just regexprep)\r\n\u003c/pre\u003e","function_template":"function [H]=BabyH_V(str)\r\n H='';\r\n v= regexp(str,'[''''\"\\s]','split');\r\nend","test_suite":"%%\r\ntic\r\nvstr='G 7''4\" 9''11\"';\r\nvexp='8''1\" to 8''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''1\" 4''10\"';\r\nvexp='5''11\" to 6''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''3\" 2''9\"';\r\nvexp='3''5\" to 4''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''10\" 4''4\"';\r\nvexp='2''7\" to 3''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''0\" 9''7\"';\r\nvexp='7''3\" to 7''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''5\" 4''8\"';\r\nvexp='3''6\" to 4''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''3\" 7''9\"';\r\nvexp='7''6\" to 8''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 8''7\" 8''0\"';\r\nvexp='8''2\" to 8''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''10\" 1''3\"';\r\nvexp='4''0\" to 4''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''9\" 1''5\"';\r\nvexp='1''7\" to 2''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''11\" 8''9\"';\r\nvexp='7''4\" to 7''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''7\" 9''3\"';\r\nvexp='6''10\" to 7''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''2\" 7''11\"';\r\nvexp='4''11\" to 5''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''0\" 3''9\"';\r\nvexp='2''10\" to 3''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''5\" 3''3\"';\r\nvexp='3''10\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''6\" 1''4\"';\r\nvexp='1''5\" to 2''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''8\" 8''7\"';\r\nvexp='8''1\" to 8''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''11\" 7''3\"';\r\nvexp='8''1\" to 8''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''0\" 1''2\"';\r\nvexp='4''7\" to 5''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''0\" 1''2\"';\r\nvexp='3''7\" to 4''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 5''6\" 5''7\"';\r\nvexp='5''5\" to 6''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''8\" 6''1\"';\r\nvexp='4''10\" to 5''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''7\" 2''3\"';\r\nvexp='2''5\" to 3''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''7\" 6''7\"';\r\nvexp='6''7\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''6\" 6''5\"';\r\nvexp='7''10\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''3\" 4''11\"';\r\nvexp='2''7\" to 3''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''0\" 5''6\"';\r\nvexp='3''3\" to 3''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''7\" 6''8\"';\r\nvexp='3''7\" to 4''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''3\" 5''11\"';\r\nvexp='4''0\" to 4''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''3\" 3''6\"';\r\nvexp='2''9\" to 3''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''10\" 1''9\"';\r\nvexp='5''8\" to 6''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''6\" 5''11\"';\r\nvexp='4''8\" to 5''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''6\" 1''2\"';\r\nvexp='3''10\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 3''7\" 9''1\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''9\" 9''11\"';\r\nvexp='7''10\" to 8''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''10\" 8''10\"';\r\nvexp='5''3\" to 5''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''11\" 7''4\"';\r\nvexp='6''7\" to 7''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''9\" 4''8\"';\r\nvexp='3''1\" to 3''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''8\" 6''3\"';\r\nvexp='7''10\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 5''6\" 8''4\"';\r\nvexp='6''10\" to 7''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''7\" 9''6\"';\r\nvexp='6''6\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''7\" 7''1\"';\r\nvexp='4''4\" to 4''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''1\" 7''10\"';\r\nvexp='5''11\" to 6''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''5\" 8''7\"';\r\nvexp='4''6\" to 5''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''0\" 1''0\"';\r\nvexp='2''0\" to 2''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''4\" 7''1\"';\r\nvexp='5''7\" to 6''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''1\" 8''1\"';\r\nvexp='5''1\" to 5''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''5\" 7''8\"';\r\nvexp='6''0\" to 6''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''7\" 8''2\"';\r\nvexp='7''4\" to 8''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''6\" 5''1\"';\r\nvexp='3''9\" to 4''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''9\" 6''9\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''4\" 5''8\"';\r\nvexp='5''6\" to 6''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''4\" 2''10\"';\r\nvexp='5''1\" to 5''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''7\" 9''5\"';\r\nvexp='7''11\" to 8''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''6\" 5''7\"';\r\nvexp='6''5\" to 7''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''11\" 8''10\"';\r\nvexp='7''9\" to 8''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''4\" 3''2\"';\r\nvexp='4''3\" to 4''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''3\" 8''3\"';\r\nvexp='8''3\" to 8''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 5''7\" 1''4\"';\r\nvexp='2''11\" to 3''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''2\" 2''4\"';\r\nvexp='4''8\" to 5''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 9''2\" 5''8\"';\r\nvexp='6''11\" to 7''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''4\" 5''5\"';\r\nvexp='5''9\" to 6''5\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 9''6\" 7''7\"';\r\nvexp='8''5\" to 9''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''6\" 1''2\"';\r\nvexp='2''4\" to 2''11\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''10\" 3''7\"';\r\nvexp='4''1\" to 4''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''10\" 2''8\"';\r\nvexp='5''3\" to 5''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 8''5\" 4''3\"';\r\nvexp='6''3\" to 6''10\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''1\" 3''0\"';\r\nvexp='4''11\" to 5''7\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 1''1\" 9''3\"';\r\nvexp='4''8\" to 5''3\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''0\" 1''11\"';\r\nvexp='3''10\" to 4''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 4''6\" 9''9\"';\r\nvexp='7''0\" to 7''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 7''6\" 3''9\"';\r\nvexp='5''1\" to 5''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 7''5\" 2''7\"';\r\nvexp='4''11\" to 5''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 6''11\" 1''0\"';\r\nvexp='3''10\" to 4''6\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''3\" 3''9\"';\r\nvexp='4''6\" to 5''1\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 8''0\" 6''1\"';\r\nvexp='6''6\" to 7''2\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 1''1\" 3''11\"';\r\nvexp='2''5\" to 3''0\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 4''8\" 2''7\"';\r\nvexp='3''1\" to 3''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 3''2\" 3''3\"';\r\nvexp='2''8\" to 3''4\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 2''5\" 6''8\"';\r\nvexp='4''0\" to 4''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='B 2''8\" 3''8\"';\r\nvexp='3''1\" to 3''8\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\n%%\r\nvstr='G 6''6\" 2''9\"';\r\nvexp='4''1\" to 4''9\"';\r\nvout=BabyH_V(vstr);\r\nassert(strcmp(vout,vexp))\r\ntoc","published":true,"deleted":false,"likes_count":1,"comments_count":0,"created_by":3097,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":11,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-06T00:21:27.000Z","updated_at":"2013-10-06T02:46:32.000Z","published_at":"2013-10-06T00:35:38.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\u003eThis Challenge is derived from\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://code.google.com/codejam/contest/2334486/dashboard#s=p1\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eGJam 2013 Veterans Baby Height\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Only the first 82 of 5958 test cases are evaluated.\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 GJam story goes that a baby's final height can be bounded given its mom's and dad's height(Ht) and its sex. Baby Nominal Ht is (Mom Ht+ Dad Ht + Baby Sex Adj)/2. A boy gets an Adjust of +5\\\" while a girl is -5\\\". The range is +/- 4\\\" from nominal. However, for fractional inches the range is reduced until endpoints are whole inches.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eInput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e str , String of Sex, Mom and Dad Height x'y\\\"\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eOutput:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e H , string of Predicted Height Range\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eExamples:\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e [str] [H]\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[B 5'11\\\" 6'2\\\"  spawns 5'11\\\" to 6'7\\\"\\nG 5'11\\\" 6'2\\\" spawns 5'6\\\" to 6'2\\\"\\nB 3'4\\\" 3'4\\\" spawns 3'3\\\" to 3'10\\\"]]\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eCommentary:\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[1) Provide input like fgetl per test case\\n2) 15 of 32 entrants completed this Challenge\\n3) This is a test of regexp and sprintf formatting (or just regexprep)]]\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":1937,"title":"Get input and output variable names","description":"Given a string representing a function header, return the variable names used for the inputs and outputs.\r\nFor example if input string s is 'function [A,B] = myfun(c,d,f)', the input names are {'c';'d';'f'} and the output names are {'A';'B'};","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: 72px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 36px; transform-origin: 407px 36px; 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: 330.5px 8px; transform-origin: 330.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eGiven a string representing a function header, return the variable names used for the inputs and outputs.\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: 368.5px 8px; transform-origin: 368.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eFor example if input string s is 'function [A,B] = myfun(c,d,f)', the input names are {'c';'d';'f'} and the output names are {'A';'B'};\u003c/span\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function [inNames, outNames] = get_variable_names(s)\r\n  y = x;\r\nend","test_suite":"%%\r\ns = 'function foo()';\r\ninNames_correct = {};\r\noutNames_correct = {};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))\r\n\r\n%%\r\ns = 'function a = foo(b)';\r\ninNames_correct = {'b'};\r\noutNames_correct = {'a'};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))\r\n\r\n%%\r\ns = 'function [myOutput] = foo(b,c)';\r\ninNames_correct = {'b';'c'};\r\noutNames_correct = {'myOutput'};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))\r\n\r\n%%\r\ns = 'function [A,B] = foo(c,d,f)';\r\ninNames_correct = {'c';'d';'f'};\r\noutNames_correct = {'A';'B'};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))\r\n\r\n%%\r\ns = sprintf('function %s=...\\nmyfun %s...\\n  %s\\n% With comments[]()\\nandCode = 4*[1 3 4/(1+2)];','[how,about , several,outputs]','(and , several, inputs ,','split,over,lotsOf,lines)');\r\ninNames_correct = {'and';'several';'inputs';'split';'over';'lotsOf';'lines'};\r\noutNames_correct = {'how';'about';'several';'outputs'};\r\n[inNames, outNames] = get_variable_names(s);\r\nassert(isequal(inNames,inNames_correct))\r\nassert(isequal(outNames,outNames_correct))","published":true,"deleted":false,"likes_count":2,"comments_count":4,"created_by":10139,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":18,"test_suite_updated_at":"2021-11-17T16:03:19.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2013-10-16T12:17:55.000Z","updated_at":"2026-03-11T11:07:43.000Z","published_at":"2013-10-16T12:25:35.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\u003eGiven a string representing a function header, return the variable names used for the inputs and outputs.\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\u003eFor example if input string s is 'function [A,B] = myfun(c,d,f)', the input names are {'c';'d';'f'} and the output names are {'A';'B'};\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":519,"title":"Pig Latin to English Translator","description":"Pig latin is a faux-language based off of English. The rules are as follows (excerpted from the \u003chttp://en.wikipedia.org/wiki/Pig_Latin Wikipedia entry for Pig Latin\u003e):\r\n\r\n1. In words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and \"ay\" is added, as in the following examples:\r\n\r\n    * happy → appy-hay\r\n    * question → estion-quay\r\n\r\n2. In words that begin with vowels, the syllable \"ay\" is simply added to the end of the word.\r\n\r\n    * another → another-ay\r\n    * about → about-ay\r\n\r\nA hyphen is sometimes used to facilitate translation back into English. Ayspray, for instance, is ambiguous, but ay-spray means \"spray\" whereas ays-pray means \"prays.\"\r\n\r\nGiven a string in Pig Latin (may be multiple words), produce the English version.","description_html":"\u003cp\u003ePig latin is a faux-language based off of English. The rules are as follows (excerpted from the \u003ca href=\"http://en.wikipedia.org/wiki/Pig_Latin\"\u003eWikipedia entry for Pig Latin\u003c/a\u003e):\u003c/p\u003e\u003cp\u003e1. In words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and \"ay\" is added, as in the following examples:\u003c/p\u003e\u003cpre\u003e    * happy → appy-hay\r\n    * question → estion-quay\u003c/pre\u003e\u003cp\u003e2. In words that begin with vowels, the syllable \"ay\" is simply added to the end of the word.\u003c/p\u003e\u003cpre\u003e    * another → another-ay\r\n    * about → about-ay\u003c/pre\u003e\u003cp\u003eA hyphen is sometimes used to facilitate translation back into English. Ayspray, for instance, is ambiguous, but ay-spray means \"spray\" whereas ays-pray means \"prays.\"\u003c/p\u003e\u003cp\u003eGiven a string in Pig Latin (may be multiple words), produce the English version.\u003c/p\u003e","function_template":"function e = piglatin2english( p )\r\n  e = p;\r\nend","test_suite":"%%\r\nstr1 = 'estion-quay';\r\nstr2 = 'question';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'another-ay';\r\nstr2 = 'another';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'ix-nay';\r\nstr2 = 'nix';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'another-ay one-ay ites-bay e-thay ust-day';\r\nstr2 = 'another one bites the dust';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'ow-hay uch-may ood-way ould-way a-ay oodchuck-way uck-chay if-ay a-ay oodchuck-way ould-cay uck-chay ood-way';\r\nstr2 = 'how much wood would a woodchuck chuck if a woodchuck could chuck wood';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'eter-pay iper-pay icked-pay a-ay eck-pay of-ay ickle-pay eppers-pay';\r\nstr2 = 'peter piper picked a peck of pickle peppers';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'our-fay ore-scay';\r\nstr2 = 'four score';\r\nstr1_f = piglatin2english(str1);\r\nassert(strcmp(str1_f,str2))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":166,"test_suite_updated_at":"2016-12-12T17:58:46.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-03-22T15:04:46.000Z","updated_at":"2026-03-15T01:34:17.000Z","published_at":"2012-03-22T15:05:17.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\u003ePig latin is a faux-language based off of English. The rules are as follows (excerpted from the\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/Pig_Latin\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eWikipedia entry for Pig Latin\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\u003cw:p\u003e\u003cw:pPr\u003e\u003cw:pStyle w:val=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e1. In words that begin with consonant sounds, the initial consonant or consonant cluster is moved to the end of the word, and \\\"ay\\\" is added, as in the following examples:\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[    * happy → appy-hay\\n    * question → estion-quay]]\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\u003e2. In words that begin with vowels, the syllable \\\"ay\\\" is simply added to the end of the word.\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[    * another → another-ay\\n    * about → about-ay]]\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\u003eA hyphen is sometimes used to facilitate translation back into English. Ayspray, for instance, is ambiguous, but ay-spray means \\\"spray\\\" whereas ays-pray means \\\"prays.\\\"\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\u003eGiven a string in Pig Latin (may be multiple words), produce the English version.\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":22,"title":"Remove the vowels","description":"Remove all the vowels in the given phrase.\n\nExample:\n\n Input  s1 = 'Jack and Jill went up the hill'\n Output s2 is 'Jck nd Jll wnt p th hll'\n","description_html":"\u003cp\u003eRemove all the vowels in the given phrase.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input  s1 = 'Jack and Jill went up the hill'\n Output s2 is 'Jck nd Jll wnt p th hll'\u003c/pre\u003e","function_template":"function s2 = refcn(s1)\n  s2 = s1;\nend","test_suite":"%%\ns1 = 'Jack and Jill went up the hill'; \ns2 = 'Jck nd Jll wnt p th hll';\nassert(isequal(s2,refcn(s1)))\n\n%%\ns1 = 'I don''t want to work. I just want to bang on the drum all day.'; \ns2 = ' dn''t wnt t wrk.  jst wnt t bng n th drm ll dy.'; \nassert(isequal(s2,refcn(s1)))","published":true,"deleted":false,"likes_count":30,"comments_count":13,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6440,"test_suite_updated_at":"2012-01-18T01:00:20.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:20.000Z","updated_at":"2026-03-23T05:31:20.000Z","published_at":"2012-01-18T01:00:20.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\u003eRemove all the vowels in the given phrase.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input  s1 = 'Jack and Jill went up the hill'\\n Output s2 is 'Jck nd Jll wnt p th hll']]\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":66,"title":"Find the two-word state names","description":"Given a list of states, remove all the states that have two-word names.\r\n\r\nIf\r\n\r\n s1 = 'Alabama Montana North Carolina Vermont Nevada'; \r\n\r\nthen\r\n\r\n s2 = 'Alabama Montana  Vermont Nevada';","description_html":"\u003cp\u003eGiven a list of states, remove all the states that have two-word names.\u003c/p\u003e\u003cp\u003eIf\u003c/p\u003e\u003cpre\u003e s1 = 'Alabama Montana North Carolina Vermont Nevada'; \u003c/pre\u003e\u003cp\u003ethen\u003c/p\u003e\u003cpre\u003e s2 = 'Alabama Montana  Vermont Nevada';\u003c/pre\u003e","function_template":"function s2 = refcn(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada New Hampshire New Jersey New Mexico New York North Carolina North Dakota Ohio Oklahoma Oregon Pennsylvania Rhode Island South Carolina South Dakota Tennessee Texas Utah Vermont Virginia Washington West Virginia Wisconsin Wyoming';\r\n\r\ns2 = 'Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada       Ohio Oklahoma Oregon Pennsylvania    Tennessee Texas Utah Vermont Virginia Washington  Wisconsin Wyoming'; \r\n\r\nassert(isequal(s2,refcn(s1)))\r\n\r\n%%\r\ns1 = 'New York Nevada Texas Utah Vermont West Virginia Virginia';\r\n\r\ns2 = ' Nevada Texas Utah Vermont  Virginia'; \r\n\r\nassert(isequal(s2,refcn(s1)))","published":true,"deleted":false,"likes_count":6,"comments_count":16,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1220,"test_suite_updated_at":"2012-06-05T14:38:53.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:26.000Z","updated_at":"2026-02-04T16:01:58.000Z","published_at":"2012-01-18T01:00: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=\\\"text\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eGiven a list of states, remove all the states that have two-word names.\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\u003eIf\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[ s1 = 'Alabama Montana North Carolina Vermont Nevada';]]\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\u003ethen\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[ s2 = 'Alabama Montana  Vermont Nevada';]]\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":44231,"title":"Is it a mail?","description":"Electronic mail, or email, is a method of exchanging digital messages between people using digital devices such as computers, mobile phones and other electronics. Email first entered substantial use in the 1960s and by the mid-1970s had taken the form now recognized as email. Email operates across computer networks, which today is primarily the Internet. \r\nWrite a function witch help you to verify if a string given is a mail address or not, true if you want to say yes it's a mail, and false if not a mail address.\r\nReference","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: 165px; display: block; min-width: 0px; padding-block-start: 0px; padding-top: 0px; perspective-origin: 407px 82.5px; transform-origin: 407px 82.5px; vertical-align: baseline; \"\u003e\u003cdiv style=\"block-size: 84px; 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 42px; text-align: left; transform-origin: 384px 42px; 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: 361.5px 8px; transform-origin: 361.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eElectronic mail, or email, is a method of exchanging digital messages between people using digital devices such as computers, mobile phones and other electronics. Email first entered substantial use in the 1960s and by the mid-1970s had taken the form now recognized as email. Email operates across computer networks, which today is primarily the Internet. \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: 383.5px 8px; transform-origin: 383.5px 8px; unicode-bidi: normal; \"\u003e\u003cspan style=\"\"\u003eWrite a function witch help you to verify if a string given is a mail address or not, true if you want to say yes it's a mail, and false if not a mail address.\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\u003ca target='_blank' href = \"https://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-an-email-address\"\u003e\u003cspan style=\"\"\u003e\u003cspan style=\"\"\u003eReference\u003c/span\u003e\u003c/span\u003e\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e","function_template":"function y = ismail(x)\r\n  y = true;\r\nend","test_suite":"%%\r\nx ='ilove@cody.math';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='goc3@kjkjhedfqoishdoifqjsdjvkshiufghiorhoihfoiqphsoihqohfoiqhpsoiffvhnqokshfvoiqhdshfoviqhskfhvoqisdhfvqshoifvhqosidfvioqsfdivhqsoifdvghjqsiofvqoisjoivqhsoifhvqshfvhqsfhvqklsffnvkqsjdfnvqksjfnvqklfdshvqkslvjklqskvlqjslvkqsnvqklsdfvklqsdfvjnqkldfsvkqklvjqfvklqdjf.dz';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='goc3@kjkjhedfqoishdoifqjsdjvkshiufghiorhoihfoiqphsoihqohfoiqhpsoiffvhnqokshfvoiqhdshfoviqhskfhvoqisdhfvqshoifvhqosidfvioqsfdivhqsoifdvghjqsiofvqoisjoivqhsoifhvqshfvhqsfhvqklsffnvkqsjdfnvqksjfnvqklfdshvqksl@vjklqskvlqjslvkqsnvqklsdfvklqsdfvjnqkld.dz';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx=1223;\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='123@mathworks.com';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='james@mathworks@com';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='msila@tarmount.com';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='elon.musk@twitter.com';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='ssssss@m@thworks.xyz';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='mes@rym.co.uk';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='abc?!@bro.tr..dz';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='abcd@?ml?club';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='abcd@3.141592653589793238462643383279502884197169399375105820974944592.com';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='info@thelongestdomainnameintheworldandthensomeandthensomemoreandmore.com';\r\ncorrect_answer = true;\r\nassert(isequal(ismail(x),correct_answer))\r\n%%\r\nx ='info@thelongestdomainnameintheworld andthensomeandthensomemoreandmore.com';\r\ncorrect_answer = false;\r\nassert(isequal(ismail(x),correct_answer))\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":8,"created_by":37163,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":17,"test_suite_updated_at":"2022-02-16T07:28:42.000Z","rescore_all_solutions":false,"group_id":1,"created_at":"2017-06-02T17:45:40.000Z","updated_at":"2026-03-19T10:29:17.000Z","published_at":"2017-06-02T17:45:39.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\u003eElectronic mail, or email, is a method of exchanging digital messages between people using digital devices such as computers, mobile phones and other electronics. Email first entered substantial use in the 1960s and by the mid-1970s had taken the form now recognized as email. Email operates across computer networks, which today is primarily the Internet. \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 witch help you to verify if a string given is a mail address or not, true if you want to say yes it's a mail, and false if not a mail address.\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:hyperlink w:docLocation=\\\"https://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-an-email-address\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eReference\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\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":28,"title":"Counting Money","description":"Add the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99.\r\n\r\nExample:\r\n\r\n Input a = {'$12,001.87','$0.04','$12,003,887.55','$0.32'};\r\n Output b is 12015889.78","description_html":"\u003cp\u003eAdd the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input a = {'$12,001.87','$0.04','$12,003,887.55','$0.32'};\r\n Output b is 12015889.78\u003c/pre\u003e","function_template":"function b = moneySum(a)\r\n\r\n  b = 0;\r\n\r\nend","test_suite":"%%\r\na = {'$12,001.87','$0.04','$103,887.55','$0.32'};\r\nb =   115889.78;\r\nassert(abs(moneySum(a)-b) \u003c 1e-4)\r\n\r\n%%\r\na = {'$0.02'};\r\nb =   0.02;\r\nassert(abs(moneySum(a)-b) \u003c 1e-4)\r\n\r\n%%\r\na = {'$81.47','$12.69','$91,337.60'};\r\nb =    91431.76;\r\nassert(abs(moneySum(a)-b) \u003c 1e-4)","published":true,"deleted":false,"likes_count":17,"comments_count":3,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":3811,"test_suite_updated_at":"2012-11-20T15:21:59.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:20.000Z","updated_at":"2026-02-28T05:02:26.000Z","published_at":"2012-01-18T01:00:20.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\u003eAdd the numbers given in the cell array of strings. The strings represent amounts of money using this notation: $99,999.99.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input a = {'$12,001.87','$0.04','$12,003,887.55','$0.32'};\\n Output b is 12015889.78]]\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":1383,"title":"Count letters occurence in text, specific to words with a given length.","description":"Build a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\r\n\r\n* Case insensitive.\r\n* Words contain only letters a-zA-Z, but the string can contain punctuation.\r\n\r\n*Example*\r\n\r\n \u003e\u003e txt = 'Hello World, from MATLAB' ;\r\n \u003e\u003e nl  = 5 ;                              % Number of letters.\r\n \u003e\u003e nlWords_getCounts(txt, nl)\r\n ans = \r\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0\r\n\r\nhere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\r\n ","description_html":"\u003cp\u003eBuild a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\u003c/p\u003e\u003cul\u003e\u003cli\u003eCase insensitive.\u003c/li\u003e\u003cli\u003eWords contain only letters a-zA-Z, but the string can contain punctuation.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cpre\u003e \u003e\u003e txt = 'Hello World, from MATLAB' ;\r\n \u003e\u003e nl  = 5 ;                              % Number of letters.\r\n \u003e\u003e nlWords_getCounts(txt, nl)\r\n ans = \r\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0\u003c/pre\u003e\u003cp\u003ehere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\u003c/p\u003e","function_template":"function counts = nlWords_getCounts(txt, nl)\r\n  counts = 0 ;\r\nend","test_suite":"%%\r\ntxt = 'Hello World, from MATLAB' ;\r\nnl  = 5 ;\r\ncounts_correct = [0 0 0 1 1 0 0 1 0 0 0 3 0 0 2 0 0 1 0 0 0 0 1 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n\r\n%%\r\ntxt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.'\r\nnl  = 9 ;\r\ncounts_correct = [3 0 3 1 5 0 1 1 0 0 0 1 0 2 1 2 0 2 2 0 2 0 1 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n\r\n%%\r\ntxt = 'UPPER converts any lowercase characters in the string str to the corresponding uppercase characters and leaves all other characters unchanged.'\r\nnl  = 10 ;\r\ncounts_correct = [6 0 6 0 3 0 0 3 0 0 0 0 0 0 0 0 0 6 3 3 0 0 0 0 0 0];\r\nassert(isequal(nlWords_getCounts(txt, nl),counts_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":9862,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":197,"test_suite_updated_at":"2013-03-25T03:27:53.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2013-03-25T03:08:33.000Z","updated_at":"2026-03-10T20:25:05.000Z","published_at":"2013-03-25T03:27:53.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\u003eBuild a function with two input arguments: a string and a word length (number of letters), that outputs a vector of counts of the 26 letters of the alphabet, specific to words with a given length.\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\u003eCase insensitive.\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\u003eWords contain only letters a-zA-Z, but the string can contain punctuation.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ \u003e\u003e txt = 'Hello World, from MATLAB' ;\\n \u003e\u003e nl  = 5 ;                              % Number of letters.\\n \u003e\u003e nlWords_getCounts(txt, nl)\\n ans = \\n     0  0  0  1  1  0  0  1  0  0  0  3  0  0  2  0  0  1  0  0  0  0  1  0  0  0]]\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\u003ehere, two 5 letters words are found: 'Hello' and 'World'. The output vector is the count of letters (1 to 26) in these two words taken together. For example, letter 12 is 'l/L' and we see that it appears 3 times, hence the count of 3.\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":13,"title":"Remove all the consonants","description":"Remove all the consonants in the given phrase.\r\n\r\nExample:\r\n\r\n Input  s1 = 'Jack and Jill went up the hill'; \r\n Output s2 is 'a a i e u e i';","description_html":"\u003cp\u003eRemove all the consonants in the given phrase.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input  s1 = 'Jack and Jill went up the hill'; \r\n Output s2 is 'a a i e u e i';\u003c/pre\u003e","function_template":"function s2 = refcn(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'Jack and Jill went up the hill'; \r\ns2 = 'a a i e u e i';\r\nassert(isequal(s2,refcn(s1)))\r\n\r\n%%\r\ns1 = 'I don''t want to work. I just want to bang on the drum all day.'; \r\ns2 = 'I o'' a o o. I u a o a o e u a a.'; \r\nassert(isequal(s2,refcn(s1)))","published":true,"deleted":false,"likes_count":26,"comments_count":23,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":4183,"test_suite_updated_at":"2012-02-03T17:52:34.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:18.000Z","updated_at":"2026-03-23T02:01:50.000Z","published_at":"2012-01-18T01:00:18.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\u003eRemove all the consonants in the given phrase.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input  s1 = 'Jack and Jill went up the hill'; \\n Output s2 is 'a a i e u e i';]]\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":80,"title":"Test for balanced parentheses","description":"Given the input inStr, give the boolean output out indicating whether all\r\nthe parentheses are balanced. \r\n \r\nExamples:\r\n\r\n* If inStr is '(()', the output is false.\r\n* If inStr is '(xyz)(ab)' the output is true.\r\n* If inStr is ')(', the output is false.\r\n \r\nThe string may include characters other than ( and ), but you should ignore them.\r\n\r\nIncidentally, this problem was inspired from the \u003chttp://rosettacode.org/wiki/Balanced_brackets Rosetta Code site\u003e. Why not create a few problems of your own by poking around \u003chttp://rosettacode.org/wiki/Category:Programming_Tasks the tasks\u003e at Rosetta Code?","description_html":"\u003cp\u003eGiven the input inStr, give the boolean output out indicating whether all\r\nthe parentheses are balanced.\u003c/p\u003e\u003cp\u003eExamples:\u003c/p\u003e\u003cul\u003e\u003cli\u003eIf inStr is '(()', the output is false.\u003c/li\u003e\u003cli\u003eIf inStr is '(xyz)(ab)' the output is true.\u003c/li\u003e\u003cli\u003eIf inStr is ')(', the output is false.\u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThe string may include characters other than ( and ), but you should ignore them.\u003c/p\u003e\u003cp\u003eIncidentally, this problem was inspired from the \u003ca href=\"http://rosettacode.org/wiki/Balanced_brackets\"\u003eRosetta Code site\u003c/a\u003e. Why not create a few problems of your own by poking around \u003ca href=\"http://rosettacode.org/wiki/Category:Programming_Tasks\"\u003ethe tasks\u003c/a\u003e at Rosetta Code?\u003c/p\u003e","function_template":"function out = isBalanced(inStr)\r\n  out = false;\r\nend","test_suite":"%%\r\n\r\ninStr = '()';\r\nout_correct = true;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = ')';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = '(z*(a-(x+3))/(y))';\r\nout_correct = true;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = ')(';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = '(x)(x-y)';\r\nout_correct = true;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = ':-)';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = ')()';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))\r\n\r\n%%\r\n\r\ninStr = '(()';\r\nout_correct = false;\r\nassert(isequal(isBalanced(inStr),out_correct))","published":true,"deleted":false,"likes_count":9,"comments_count":1,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":1247,"test_suite_updated_at":"2013-07-10T21:27:37.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:28.000Z","updated_at":"2026-02-04T17:33:56.000Z","published_at":"2012-01-18T01:00:28.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 the input inStr, give the boolean output out indicating whether all the parentheses are balanced.\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\u003eExamples:\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\u003eIf inStr is '(()', the output is false.\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\u003eIf inStr is '(xyz)(ab)' the output is true.\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\u003eIf inStr is ')(', the output is false.\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 string may include characters other than ( and ), but you should ignore them.\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\u003eIncidentally, this problem was inspired from the\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://rosettacode.org/wiki/Balanced_brackets\\\"\u003e\u003cw:r\u003e\u003cw:t\u003eRosetta Code site\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e. Why not create a few problems of your own by poking around\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://rosettacode.org/wiki/Category:Programming_Tasks\\\"\u003e\u003cw:r\u003e\u003cw:t\u003ethe tasks\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:hyperlink\u003e\u003cw:r\u003e\u003cw:t\u003e at Rosetta Code?\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":44306,"title":"Is it really a 5?","description":"A number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \"five\" anywhere. For example:\r\n\r\n n = 5; return true since it is spelled \"five\"\r\n n = 15; return false since it is spelled \"fifteen\" and does not contain the four-letter string \"five\"\r\n\r\nThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \"five\" for this problem.\r\n\r\nSee the test suite for more examples.","description_html":"\u003cp\u003eA number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \"five\" anywhere. For example:\u003c/p\u003e\u003cpre\u003e n = 5; return true since it is spelled \"five\"\r\n n = 15; return false since it is spelled \"fifteen\" and does not contain the four-letter string \"five\"\u003c/pre\u003e\u003cp\u003eThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \"five\" for this problem.\u003c/p\u003e\u003cp\u003eSee the test suite for more examples.\u003c/p\u003e","function_template":"function tf = is_it_really_a_5(n)\r\n tf = 0;\r\nend","test_suite":"%%\r\nn = 5;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 25;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 35;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 52;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 59;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 85;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 105;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 115;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 125;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 250;\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 500;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 555;\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000; %5,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15000; %15,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55555; %55,555\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000; %50,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 55000; %55,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50500; %50,500\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50050; %50,050\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50005; %50,005\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 500000; %500,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000000; %5,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 15000000; %15,000,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50000000; %50,000,000\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 105000000; %105,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50050050; %50,050,050\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 50000005; %50,000,005\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000015; %50,000,015\r\nassert(isequal(is_it_really_a_5(n),0))\r\n\r\n%%\r\nn = 500000000; %500,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 5000000000; %5,000,000,000\r\nassert(isequal(is_it_really_a_5(n),1))\r\n\r\n%%\r\nn = 50000000000; %50,000,000,000\r\nassert(isequal(is_it_really_a_5(n),0))","published":true,"deleted":false,"likes_count":7,"comments_count":1,"created_by":26769,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":316,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":34,"created_at":"2017-09-08T22:07:48.000Z","updated_at":"2026-03-18T13:28:44.000Z","published_at":"2017-10-16T01:45:06.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\u003eA number containing at least one five will be passed to your function, which must return true or false depending upon whether the English spelling of the number may contain \\\"five\\\" anywhere. For example:\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[ n = 5; return true since it is spelled \\\"five\\\"\\n n = 15; return false since it is spelled \\\"fifteen\\\" and does not contain the four-letter string \\\"five\\\"]]\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\u003eThis criterion applies to any common spelling of the number. For example, 1500 can be written fifteen hundred. But, it can also be written one thousand five hundred. So, 1500 would be considered to contain a \\\"five\\\" for this problem.\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\u003eSee the test suite for more examples.\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":920,"title":"Eliminate Polysyllabics: Long live short words!","description":"Given a string s1, return s2 in which all the words with more than one syllable have been removed.\r\n\r\nTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\r\n\r\nSo these words are polysyllabic:\r\n\r\n ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS\r\n\r\nThese words are monosyllabic:\r\n\r\n STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE\r\n\r\nHere are some examples of one-syllable words that I WON'T use because they violate my rules:\r\n\r\n ONE ICED JUICE PLEASE\r\n\r\nAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\r\n\r\nExample:\r\n\r\n Input:  'The all day meetings will continue until we learn why productivity is so low'\r\n\r\n Output: 'The all day will we learn why is so low'","description_html":"\u003cp\u003eGiven a string s1, return s2 in which all the words with more than one syllable have been removed.\u003c/p\u003e\u003cp\u003eTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\u003c/p\u003e\u003cp\u003eSo these words are polysyllabic:\u003c/p\u003e\u003cpre\u003e ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS\u003c/pre\u003e\u003cp\u003eThese words are monosyllabic:\u003c/p\u003e\u003cpre\u003e STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE\u003c/pre\u003e\u003cp\u003eHere are some examples of one-syllable words that I WON'T use because they violate my rules:\u003c/p\u003e\u003cpre\u003e ONE ICED JUICE PLEASE\u003c/pre\u003e\u003cp\u003eAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input:  'The all day meetings will continue until we learn why productivity is so low'\u003c/pre\u003e\u003cpre\u003e Output: 'The all day will we learn why is so low'\u003c/pre\u003e","function_template":"function s2 = just_short_words(s1)\r\n  s2 = s1;\r\nend","test_suite":"%%\r\ns1 = 'The all day meetings will continue until we learn why productivity is so low';\r\ns2_correct = 'The all day will we learn why is so low';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'I am perpetually perplexed my big brain notwithstanding';\r\ns2_correct = 'I am my big brain';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n\r\n%%\r\ns1 = 'Lazy gravy calico sky ipso facto sweet potato pie';\r\ns2_correct = 'sky sweet pie';\r\nassert(isequal(just_short_words(s1),s2_correct))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":2,"created_by":7,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":150,"test_suite_updated_at":"2012-12-21T22:37:32.000Z","rescore_all_solutions":false,"group_id":28,"created_at":"2012-08-23T14:29:37.000Z","updated_at":"2026-02-02T20:02:03.000Z","published_at":"2012-12-21T19:04:46.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 s1, return s2 in which all the words with more than one syllable have been removed.\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\u003eTo make things simple, we will (for the purposes of this problem) define a polysyllabic word as one in which at least two vowel groups are separated by a least one consonant group. Consider vowels to come from the set [aeiouy]. All other letters are considered consonants. There are many exceptions to the rules I have defined here, but I will keep the test suite consistent with these rules.\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\u003eSo these words are polysyllabic:\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[ ANY BUSY POLICEMAN EXPECTS COUNTLESS INTERRUPTIONS]]\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\u003eThese words are monosyllabic:\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[ STRENGTH IS THE SUM OF ALL WE KNOW TO BE TRUE]]\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\u003eHere are some examples of one-syllable words that I WON'T use because they violate my rules:\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[ ONE ICED JUICE PLEASE]]\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\u003eAfter you have removed the offending words, de-dupe the spaces. That is, any remaining words should be separated by exactly one space. There should be no spaces at the beginning or end of the output string s2. Letters may be upper or lower case.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input:  'The all day meetings will continue until we learn why productivity is so low'\\n\\n Output: 'The all day will we learn why is so low']]\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":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":15,"title":"Find the longest sequence of 1's in a binary sequence.","description":"Given a string such as\n\n s = '011110010000000100010111'\n\nfind the length of the longest string of consecutive 1's. In this example, the answer would be 4.\n\nExample:\n\n Input  x = '110100111'\n Output y is 3","description_html":"\u003cp\u003eGiven a string such as\u003c/p\u003e\u003cpre\u003e s = '011110010000000100010111'\u003c/pre\u003e\u003cp\u003efind the length of the longest string of consecutive 1's. In this example, the answer would be 4.\u003c/p\u003e\u003cp\u003eExample:\u003c/p\u003e\u003cpre\u003e Input  x = '110100111'\n Output y is 3\u003c/pre\u003e","function_template":"function y = lengthOnes(x)\n  y = x\nend","test_suite":"%%\nx = '0';\ny_correct = 0;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '1';\ny_correct = 1;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '01';\ny_correct = 1;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '10';\ny_correct = 1;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '00';\ny_correct = 0;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '11';\n y_correct = 2;\nassert(isequal(lengthOnes(x),y_correct))\n%%\nx = '1111111111';\ny_correct = 10;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '100101011111010011111';\ny_correct = 5;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '01010101010101010101010101';\ny_correct = 1;\nassert(isequal(lengthOnes(x),y_correct))\n\n%%\nx = '0101010111000101110001011100010100001110110100000000110001001000001110001000111010101001101100001111';\ny_correct = 4;\nassert(isequal(lengthOnes(x),y_correct))","published":true,"deleted":false,"likes_count":81,"comments_count":10,"created_by":1,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6696,"test_suite_updated_at":"2012-01-18T01:00:19.000Z","rescore_all_solutions":false,"group_id":2,"created_at":"2012-01-18T01:00:19.000Z","updated_at":"2026-04-03T20:38:16.000Z","published_at":"2012-01-18T01:00:19.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 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[ s = '011110010000000100010111']]\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\u003efind the length of the longest string of consecutive 1's. In this example, the answer would be 4.\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=\\\"code\\\"/\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003e\u003c![CDATA[ Input  x = '110100111'\\n Output y is 3]]\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":43963,"title":"Finding operators in a MATLAB function in a string.","description":"The aim is to find if there is an operator inside a MATLAB function call in a formula. The input is a string and the output is a boolean which is true if the string contains at least one operator in a function call, and false otherwise.\r\n\r\nFor example:\r\n\r\n 'min(var1+var2,2)' =\u003e true\r\n\r\n 'min(1,2)+min(3,4)' =\u003e false\r\n\r\n 'min(min(1,2),3))' =\u003e false\r\n\r\n 'min(min(1,var1+2),3))' =\u003e true\r\n\r\n '4*var1' =\u003e false, there is no MATLAB function\r\n\r\nYou can assume that all opening brackets are closed.","description_html":"\u003cp\u003eThe aim is to find if there is an operator inside a MATLAB function call in a formula. The input is a string and the output is a boolean which is true if the string contains at least one operator in a function call, and false otherwise.\u003c/p\u003e\u003cp\u003eFor example:\u003c/p\u003e\u003cpre\u003e 'min(var1+var2,2)' =\u0026gt; true\u003c/pre\u003e\u003cpre\u003e 'min(1,2)+min(3,4)' =\u0026gt; false\u003c/pre\u003e\u003cpre\u003e 'min(min(1,2),3))' =\u0026gt; false\u003c/pre\u003e\u003cpre\u003e 'min(min(1,var1+2),3))' =\u0026gt; true\u003c/pre\u003e\u003cpre\u003e '4*var1' =\u0026gt; false, there is no MATLAB function\u003c/pre\u003e\u003cp\u003eYou can assume that all opening brackets are closed.\u003c/p\u003e","function_template":"function y = FindingOperators( x )\r\n  y = x;\r\nend","test_suite":"%%\r\nx = 'min(var1+var2,2)';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(1,2)+min(3,4)';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(min(1,2),3))';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(min(1,var1+2),3))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n\r\n%%\r\n\r\nx = '4*var1';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4*(var1+2)';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n\r\n%%\r\n\r\nx = 'max(min(1,var1-2),3))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+abs(2)';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+abs(2/var1)';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+abs(2+min(1+5,1))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+max(2,min(1+5,1))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = '4+max((2,min(1+5,1)))';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(2-1,1)+abs(-5)';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(var1,1)+abs(-5)';\r\ny_correct = false;\r\nassert(isequal(FindingOperators(x),y_correct))\r\n\r\n%%\r\n\r\nx = 'min(min(var1,var2),1+3)';\r\ny_correct = true;\r\nassert(isequal(FindingOperators(x),y_correct))","published":true,"deleted":false,"likes_count":1,"comments_count":1,"created_by":55046,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":7,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2016-12-22T09:44:46.000Z","updated_at":"2016-12-22T15:57:10.000Z","published_at":"2016-12-22T09:44:46.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\u003eThe aim is to find if there is an operator inside a MATLAB function call in a formula. The input is a string and the output is a boolean which is true if the string contains at least one operator in a function call, and false otherwise.\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\u003eFor example:\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[ 'min(var1+var2,2)' =\u003e true\\n\\n 'min(1,2)+min(3,4)' =\u003e false\\n\\n 'min(min(1,2),3))' =\u003e false\\n\\n 'min(min(1,var1+2),3))' =\u003e true\\n\\n '4*var1' =\u003e false, there is no MATLAB function]]\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\u003eYou can assume that all opening brackets are closed.\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":45434,"title":"Weighted Names","description":"A cell is given which contains several names. You've to return those names sorted by their weight. \r\n\r\nWeight is to be calculated by the following rules - \r\n \r\n 1.each letter's weight is the ASCII value. \r\n\r\n 2.the 1st name weights 2 times its original value but if the name contains any middle name \r\n   then the middle name would weight 2x while 1st name would weight 3x.\r\n   The family name will always weight 1x.\r\n\r\n\r\n 3. Some of the names might contain some prefix like Col, Prof, Hon etc. They would weight\r\n   10 times their 1st letter. [each letter is not to be weighted for this case]\r\n 4. Again some of the names might also contain some suffix.\r\n\r\nFor example,\r\n\r\n  Ser Arthur Dayne\r\n\r\n Here, 'Ser' is a prefix. so value = 83*10 = 830.  [ASCII value of 'S' is 83]\r\n       'Dayne' is the family name. so value = 497*1 = 497\r\n       'Arthur' is the 1st name.   so value = 630*2 = 1260\r\n So total value= 830 + 497 + 1260 = 2587.\r\n","description_html":"\u003cp\u003eA cell is given which contains several names. You've to return those names sorted by their weight.\u003c/p\u003e\u003cp\u003eWeight is to be calculated by the following rules -\u003c/p\u003e\u003cpre\u003e 1.each letter's weight is the ASCII value. \u003c/pre\u003e\u003cpre\u003e 2.the 1st name weights 2 times its original value but if the name contains any middle name \r\n   then the middle name would weight 2x while 1st name would weight 3x.\r\n   The family name will always weight 1x.\u003c/pre\u003e\u003cpre\u003e 3. Some of the names might contain some prefix like Col, Prof, Hon etc. They would weight\r\n   10 times their 1st letter. [each letter is not to be weighted for this case]\r\n 4. Again some of the names might also contain some suffix.\u003c/pre\u003e\u003cp\u003eFor example,\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003eSer Arthur Dayne\r\n\u003c/pre\u003e\u003cpre\u003e Here, 'Ser' is a prefix. so value = 83*10 = 830.  [ASCII value of 'S' is 83]\r\n       'Dayne' is the family name. so value = 497*1 = 497\r\n       'Arthur' is the 1st name.   so value = 630*2 = 1260\r\n So total value= 830 + 497 + 1260 = 2587.\u003c/pre\u003e","function_template":"function out = weighted_names(x)","test_suite":"%%\r\nx={'Col Theodore Roosevelt', 'Gen Ulysses S. Grant','Cap Abraham Lincoln'};\r\ny_correct ={'Gen Ulysses S. Grant','Col Theodore Roosevelt','Cap Abraham Lincoln'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx={'Jean-Marie Sainthillier','Asif Newaz','Binbin Qi','Alfonso Nieto-Castanon','J. S. Kowontan'} ;\r\ny_correct ={'Jean-Marie Sainthillier','Alfonso Nieto-Castanon','J. S. Kowontan','Binbin Qi','Asif Newaz'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx={'Ser Gerold Hightower','Prince Lewyn Martell','Ser Barristan Selmy','Ser Arthur Dayne','Ser Jaime Lannister'};\r\ny_correct ={'Ser Barristan Selmy','Ser Gerold Hightower','Ser Jaime Lannister','Ser Arthur Dayne','Prince Lewyn Martell'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx={'Eddard Ned Stark','Rob Stark','Brandon Stark','Aegon Targaryen VI','George R. R. Martin'};\r\ny_correct ={'George R. R. Martin','Eddard Ned Stark','Aegon Targaryen VI','Brandon Stark','Rob Stark'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx = {'william','Ser Arthur','William II','William III'};\r\ny_correct ={'Ser Arthur','William II','William III','william'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n\r\n%%\r\nx={'Harry','Harry Potter','Harry James Potter','Ms. Hermione Granzer','Albus Percival Wulfric Brian Dumbledore'} ;\r\ny_correct ={'Albus Percival Wulfric Brian Dumbledore','Harry James Potter','Ms. Hermione Granzer','Harry Potter','Harry'};\r\nassert(isequal(weighted_names(x),y_correct))\r\n","published":true,"deleted":false,"likes_count":1,"comments_count":9,"created_by":363598,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":6,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2020-04-10T07:52:03.000Z","updated_at":"2020-04-10T09:59:56.000Z","published_at":"2020-04-10T09:57:55.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\u003eA cell is given which contains several names. You've to return those names sorted by their weight.\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\u003eWeight is to be calculated by the following rules -\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[ 1.each letter's weight is the ASCII value. \\n\\n 2.the 1st name weights 2 times its original value but if the name contains any middle name \\n   then the middle name would weight 2x while 1st name would weight 3x.\\n   The family name will always weight 1x.\\n\\n 3. Some of the names might contain some prefix like Col, Prof, Hon etc. They would weight\\n   10 times their 1st letter. [each letter is not to be weighted for this case]\\n 4. Again some of the names might also contain some suffix.]]\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\u003eFor example,\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[Ser Arthur Dayne\\n\\n Here, 'Ser' is a prefix. so value = 83*10 = 830.  [ASCII value of 'S' is 83]\\n       'Dayne' is the family name. so value = 497*1 = 497\\n       'Arthur' is the 1st name.   so value = 630*2 = 1260\\n So total value= 830 + 497 + 1260 = 2587.]]\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":1860,"title":"Remove TeX from string","description":"Matlab’s TeX support in figure windows is great for displaying information in a visually appealing way. However, many of the TeX elements just get in the way when displaying a label string in the command window and lead to lots of additional gibberish if you want to create a valid variable name from the TeX string using genvarname.\r\n\r\nGiven the TeX string as an input, return a string that contains only the plain text of what would be displayed in a figure window by title, xlabel, etc.\r\n\r\nRetain special characters, e.g., ‘\\beta’ becomes ‘beta’.\r\n\r\nCell array inputs should return multi-line strings.","description_html":"\u003cp\u003eMatlab’s TeX support in figure windows is great for displaying information in a visually appealing way. However, many of the TeX elements just get in the way when displaying a label string in the command window and lead to lots of additional gibberish if you want to create a valid variable name from the TeX string using genvarname.\u003c/p\u003e\u003cp\u003eGiven the TeX string as an input, return a string that contains only the plain text of what would be displayed in a figure window by title, xlabel, etc.\u003c/p\u003e\u003cp\u003eRetain special characters, e.g., ‘\\beta’ becomes ‘beta’.\u003c/p\u003e\u003cp\u003eCell array inputs should return multi-line strings.\u003c/p\u003e","function_template":"function txt = tex2txt(texStr)\r\n  txt = texStr;\r\nend","test_suite":"%%\r\ntexStr = '\\beta';\r\ntxt    = 'beta';\r\nassert(isequal(tex2txt(texStr),txt))\r\n\r\n\r\n%%\r\ntexStr = ['\\fontsize{16}black {\\color{magenta}magenta '...\r\n    '\\color[rgb]{0 .5 .5}teal \\color{red}red} black again'];\r\ntxt    = 'black magenta teal red black again';\r\nassert(isequal(tex2txt(texStr),txt))\r\n\r\n\r\n%%\r\ntexStr = {'We need to work with cells, too'\r\n          '(for {\\bfmultiline} labels) and'\r\n          'return strings with newline characters.'};\r\ntxt    = sprintf(['We need to work with cells, too\\n' ...\r\n          '(for multiline labels) and\\n' ...\r\n          'return strings with newline characters.']);\r\nassert(isequal(tex2txt(texStr),txt))\r\n\r\n\r\n%%\r\ntexStr = '\\slRemove {\\bfall} \\itof \\rmthese.';\r\ntxt    = 'Remove all of these.';\r\nassert(isequal(tex2txt(texStr),txt))\r\n\r\n\r\n%%\r\ntxt    = 'variable_i^2/pi';\r\ntexStr = texlabel(txt);\r\nassert(isequal(tex2txt(texStr),txt))","published":true,"deleted":false,"likes_count":0,"comments_count":0,"created_by":10139,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":13,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":1,"created_at":"2013-09-06T08:41:30.000Z","updated_at":"2025-09-18T11:44:13.000Z","published_at":"2013-09-06T08:41:30.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\",\"relationshipId\":\"rId1\",\"target\":\"/matlab/document.xml\"},{\"relationshipType\":\"http://schemas.mathworks.com/matlab/code/2013/relationships/output\",\"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\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\u003eMatlab’s TeX support in figure windows is great for displaying information in a visually appealing way. However, many of the TeX elements just get in the way when displaying a label string in the command window and lead to lots of additional gibberish if you want to create a valid variable name from the TeX string using genvarname.\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\u003eGiven the TeX string as an input, return a string that contains only the plain text of what would be displayed in a figure window by title, xlabel, etc.\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\u003eRetain special characters, e.g., ‘\\\\beta’ becomes ‘beta’.\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\u003eCell array inputs should return multi-line strings.\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":831,"title":"Find mistyped words in text (mixed-up letters)","description":"Mistyped words are a regular occurrence in emails, texts, status updates, and the like. Many times, people send or post a second text with the correct word, usually preceded by an asterisk. In perhaps the most common case, the mistyped word contains all of the correct letters, but in the wrong order (e.g. 'I loev MATLAB').\r\n\r\nIn this problem, you are given two strings: (1) the original text and (2) the correct word(s), each preceded by an asterisk. Your function should output a cell array of the mistyped words that are being corrected.\r\n\r\n*Notes*\r\n\r\n* Assume each mistyped word has all the correct letters, but in the wrong order\r\n* Assume there is only one possible option for each correct word in the second input string\r\n* The original text may contain punctuation, but do not include punctuation in the output\r\n* Corrections are case-insensitive, but the output should contain the mistyped words as written in the original text.\r\n* There may be more than one mistyped word; if so, the correct words are presented in order (i.e. the N-th word in the second input string corresponds to the N-th mistyped word in the original text)\r\n* If the second input string is empty, return an empty cell array\r\n\r\n*Example*\r\n\r\nIf\r\n\r\n str = 'Which sword are mistyped in this srting?';\r\n correct_words = '*words *string';\r\n\r\nthen\r\n\r\n mistyped_words = {'sword','srting'};","description_html":"\u003cp\u003eMistyped words are a regular occurrence in emails, texts, status updates, and the like. Many times, people send or post a second text with the correct word, usually preceded by an asterisk. In perhaps the most common case, the mistyped word contains all of the correct letters, but in the wrong order (e.g. 'I loev MATLAB').\u003c/p\u003e\u003cp\u003eIn this problem, you are given two strings: (1) the original text and (2) the correct word(s), each preceded by an asterisk. Your function should output a cell array of the mistyped words that are being corrected.\u003c/p\u003e\u003cp\u003e\u003cb\u003eNotes\u003c/b\u003e\u003c/p\u003e\u003cul\u003e\u003cli\u003eAssume each mistyped word has all the correct letters, but in the wrong order\u003c/li\u003e\u003cli\u003eAssume there is only one possible option for each correct word in the second input string\u003c/li\u003e\u003cli\u003eThe original text may contain punctuation, but do not include punctuation in the output\u003c/li\u003e\u003cli\u003eCorrections are case-insensitive, but the output should contain the mistyped words as written in the original text.\u003c/li\u003e\u003cli\u003eThere may be more than one mistyped word; if so, the correct words are presented in order (i.e. the N-th word in the second input string corresponds to the N-th mistyped word in the original text)\u003c/li\u003e\u003cli\u003eIf the second input string is empty, return an empty cell array\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e\u003cb\u003eExample\u003c/b\u003e\u003c/p\u003e\u003cp\u003eIf\u003c/p\u003e\u003cpre\u003e str = 'Which sword are mistyped in this srting?';\r\n correct_words = '*words *string';\u003c/pre\u003e\u003cp\u003ethen\u003c/p\u003e\u003cpre\u003e mistyped_words = {'sword','srting'};\u003c/pre\u003e","function_template":"function mistyped_words = mistype(str,correct_words)\r\n  mistyped_words = {};\r\nend","test_suite":"%%\r\nstr = 'Can you tell if there is anything wrong with this string?';\r\ncorrect_words = '';\r\nmistyped_words = {};\r\nassert(isequal(mistype(str,correct_words),mistyped_words))\r\n\r\n%%\r\nstr = 'I lvoe MATLAB';\r\ncorrect_words = '*love';\r\nmistyped_words = {'lvoe'};\r\nassert(isequal(mistype(str,correct_words),mistyped_words))\r\n\r\n%%\r\nstr = 'Recieve and beleive are tow commonly misspelled words';\r\ncorrect_words = '*Receive *believe *two';\r\nmistyped_words = {'Recieve','beleive','tow'};\r\nassert(isequal(mistype(str,correct_words),mistyped_words))\r\n\r\n%%\r\nstr = 'Ihppopatomus si a hard word to psell';\r\ncorrect_words = '*Hippopotamus *is *spell';\r\nmistyped_words = {'Ihppopatomus','si','psell'};\r\nassert(isequal(mistype(str,correct_words),mistyped_words))\r\n","published":true,"deleted":false,"likes_count":4,"comments_count":0,"created_by":4793,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":179,"test_suite_updated_at":null,"rescore_all_solutions":false,"group_id":14,"created_at":"2012-07-14T01:06:08.000Z","updated_at":"2026-03-14T23:49:52.000Z","published_at":"2012-07-14T23:18:30.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\u003eMistyped words are a regular occurrence in emails, texts, status updates, and the like. Many times, people send or post a second text with the correct word, usually preceded by an asterisk. In perhaps the most common case, the mistyped word contains all of the correct letters, but in the wrong order (e.g. 'I loev MATLAB').\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\u003eIn this problem, you are given two strings: (1) the original text and (2) the correct word(s), each preceded by an asterisk. Your function should output a cell array of the mistyped words that are being corrected.\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\u003e\u003cw:t\u003eNotes\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\u003eAssume each mistyped word has all the correct letters, but in the wrong order\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\u003eAssume there is only one possible option for each correct word in the second input string\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 original text may contain punctuation, but do not include punctuation in the output\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\u003eCorrections are case-insensitive, but the output should contain the mistyped words as written in the original text.\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\u003eThere may be more than one mistyped word; if so, the correct words are presented in order (i.e. the N-th word in the second input string corresponds to the N-th mistyped word in the original text)\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\u003eIf the second input string is empty, return an empty cell array\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:rPr\u003e\u003cw:b/\u003e\u003c/w:rPr\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\u003eIf\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[ str = 'Which sword are mistyped in this srting?';\\n correct_words = '*words *string';]]\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\u003ethen\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[ mistyped_words = {'sword','srting'};]]\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\"}]}"}],"term":"tag:\"regexp\"","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:\"regexp\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"regexp\"","","\"","regexp","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f10293bd680\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f10293bd5e0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f10293bcd20\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f10293bd900\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f10293bd860\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f10293bd7c0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f10293bd720\u003e":"tag:\"regexp\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f10293bd720\u003e":"tag:\"regexp\""},"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":"search","password":"J3bGPZzQ7asjJcCk","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:\"regexp\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"regexp\"","","\"","regexp","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f10293bd680\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f10293bd5e0\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f10293bcd20\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f10293bd900\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f10293bd860\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f10293bd7c0\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f10293bd720\u003e":"tag:\"regexp\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f10293bd720\u003e":"tag:\"regexp\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":43582,"difficulty_rating":"easy"},{"id":2502,"difficulty_rating":"easy"},{"id":43132,"difficulty_rating":"easy"},{"id":44619,"difficulty_rating":"easy"},{"id":54350,"difficulty_rating":"easy"},{"id":43169,"difficulty_rating":"easy"},{"id":460,"difficulty_rating":"easy"},{"id":695,"difficulty_rating":"easy"},{"id":542,"difficulty_rating":"easy"},{"id":2033,"difficulty_rating":"easy"},{"id":42810,"difficulty_rating":"easy"},{"id":61028,"difficulty_rating":"easy-medium"},{"id":52188,"difficulty_rating":"easy-medium"},{"id":44417,"difficulty_rating":"easy-medium"},{"id":1712,"difficulty_rating":"easy-medium"},{"id":1856,"difficulty_rating":"easy-medium"},{"id":43076,"difficulty_rating":"easy-medium"},{"id":53935,"difficulty_rating":"easy-medium"},{"id":61035,"difficulty_rating":"easy-medium"},{"id":171,"difficulty_rating":"easy-medium"},{"id":44358,"difficulty_rating":"easy-medium"},{"id":43077,"difficulty_rating":"easy-medium"},{"id":877,"difficulty_rating":"easy-medium"},{"id":2500,"difficulty_rating":"easy-medium"},{"id":269,"difficulty_rating":"easy-medium"},{"id":42370,"difficulty_rating":"easy-medium"},{"id":530,"difficulty_rating":"easy-medium"},{"id":43658,"difficulty_rating":"easy-medium"},{"id":2368,"difficulty_rating":"easy-medium"},{"id":1376,"difficulty_rating":"easy-medium"},{"id":35,"difficulty_rating":"easy-medium"},{"id":823,"difficulty_rating":"easy-medium"},{"id":1915,"difficulty_rating":"easy-medium"},{"id":1937,"difficulty_rating":"easy-medium"},{"id":519,"difficulty_rating":"medium"},{"id":22,"difficulty_rating":"medium"},{"id":66,"difficulty_rating":"medium"},{"id":44231,"difficulty_rating":"medium"},{"id":28,"difficulty_rating":"medium"},{"id":1383,"difficulty_rating":"medium"},{"id":13,"difficulty_rating":"medium"},{"id":80,"difficulty_rating":"medium"},{"id":44306,"difficulty_rating":"medium"},{"id":920,"difficulty_rating":"medium"},{"id":541,"difficulty_rating":"medium"},{"id":15,"difficulty_rating":"medium"},{"id":43963,"difficulty_rating":"medium"},{"id":45434,"difficulty_rating":"medium"},{"id":1860,"difficulty_rating":"medium"},{"id":831,"difficulty_rating":"medium"}]}}