{"group":{"id":1,"name":"Community","lockable":false,"created_at":"2012-01-18T18:02:15.000Z","updated_at":"2026-04-06T14:01:22.000Z","description":"Problems submitted by members of the MATLAB Central community.","is_default":true,"created_by":161519,"badge_id":null,"featured":false,"trending":false,"solution_count_in_trending_period":0,"trending_last_calculated":"2026-04-06T00:00:00.000Z","image_id":null,"published":true,"community_created":false,"status_id":2,"is_default_group_for_player":false,"deleted_by":null,"deleted_at":null,"restored_by":null,"restored_at":null,"description_opc":null,"description_html":null,"published_at":null},"problems":[{"id":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":518,"title":"English to Pig Latin Translator","description":"Pig latin is a faux-language based off of English. The rules are as follows (excerpted from the wikipedia entry for Pig Latin):\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 english (may be multiple words), produce the Pig Latin version.","description_html":"\u003cp\u003ePig latin is a faux-language based off of English. The rules are as follows (excerpted from the wikipedia entry for Pig Latin):\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\u003cul\u003e\u003cli\u003ehappy → appy-hay\u003c/li\u003e\u003cli\u003equestion → estion-quay\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e2. In words that begin with vowels, the syllable \"ay\" is simply added to the end of the word.\u003c/p\u003e\u003cul\u003e\u003cli\u003eanother → another-ay\u003c/li\u003e\u003cli\u003eabout → about-ay\u003c/li\u003e\u003c/ul\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 english (may be multiple words), produce the Pig Latin version.\u003c/p\u003e","function_template":"function p = english2piglatin( e )\r\n  p = e;\r\nend","test_suite":"%%\r\nstr1 = 'question';\r\nstr2 = 'estion-quay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'another';\r\nstr2 = 'another-ay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'nix';\r\nstr2 = 'ix-nay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'another one bites the dust';\r\nstr2 = 'another-ay one-ay ites-bay e-thay ust-day';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'how much wood would a woodchuck chuck if a woodchuck could chuck wood';\r\nstr2 = '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\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'peter piper picked a peck of pickle peppers';\r\nstr2 = 'eter-pay iper-pay icked-pay a-ay eck-pay of-ay ickle-pay eppers-pay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'four score';\r\nstr2 = 'our-fay ore-scay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":161,"test_suite_updated_at":"2016-12-12T17:54:21.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-03-22T14:56:07.000Z","updated_at":"2026-03-15T00:58:42.000Z","published_at":"2012-03-22T15:02: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\u003ePig latin is a faux-language based off of English. The rules are as follows (excerpted from the wikipedia entry for Pig Latin):\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ehappy → appy-hay\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\u003equestion → estion-quay\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eanother → another-ay\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\u003eabout → about-ay\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 english (may be multiple words), produce the Pig Latin 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":44374,"title":"Tautology","description":"Check if the given expression is always true. For example, the sentence\r\n\r\n  '~(A \u0026 B) == (~A | ~B)'\r\n\r\nis always true.\r\n\r\nCharacters in the input sequences may include *~ \u0026 | == ( )*, whitespace, 0 for false, 1 for true and letters for variables.","description_html":"\u003cp\u003eCheck if the given expression is always true. For example, the sentence\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e'~(A \u0026 B) == (~A | ~B)'\r\n\u003c/pre\u003e\u003cp\u003eis always true.\u003c/p\u003e\u003cp\u003eCharacters in the input sequences may include \u003cb\u003e~ \u0026 | == ( )\u003c/b\u003e, whitespace, 0 for false, 1 for true and letters for variables.\u003c/p\u003e","function_template":"function y = tautology(x)\r\n  y = true;\r\nend","test_suite":"%%\r\nx = '0';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '1';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '~A';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|1';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '1\u0026A';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|B';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A\u0026B';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|A';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|~A';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '0==0';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '~0';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '~(A \u0026 B) == (~A | ~B)';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '~(Z \u0026 Y) == (~Y | ~Z)';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|X|V|W|Y|Z';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|B|C|D|E|F|G|H|I|J|K|L|M|~A|O|P|Q|R|S|T|U|X|V|W|Y|Z';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nassert(isequal(tautology('(A|B)|C'),false));\r\n%%\r\nassert(isequal(tautology('(A|B)|(C == C)'),true));\r\n%%\r\nassert(isequal(tautology('(A == B)|(B == C)|(C == A)'),true));\r\n%%\r\nassert(isequal(tautology('~(~(~(~(~(~(0))))))'),false)); \r\n%%\r\nassert(isequal(tautology('~(~(~(~(~(~(~0))))))'),true));\r\n% provided by Alfonso:\r\nassert(isequal(tautology('((0\u00261)|~B)\u0026~B'),false)); \r\n%%\r\nassert(isequal(tautology('((0\u0026~B)\u0026~B)'),false)); \r\n%%\r\nassert(isequal(tautology('((0|A)\u0026~A)'),false)); \r\n%%\r\nassert(isequal(tautology('((0|A)|1)'),true)); \r\n%%\r\nassert(isequal(tautology('((0|~B)|1)'),true)); \r\n%%\r\nassert(isequal(tautology('((1\u00260)|B)'),false)); \r\n%%\r\nassert(isequal(tautology('((1\u00261)\u0026A)'),false)); \r\n%%\r\nassert(isequal(tautology('((1|0)|A)'),true)); \r\n%%\r\nassert(isequal(tautology('((1|A)|0)'),true)); \r\n%%\r\nassert(isequal(tautology('((1|~A)\u0026B)'),false)); \r\n%%\r\nassert(isequal(tautology('((A\u00261)|~A)|A'),true)); \r\n%%\r\nassert(isequal(tautology('((A\u0026~A)\u0026~B)|~A'),false)); \r\n%%\r\nassert(isequal(tautology('((A\u0026~B)\u00261)|B'),false)); \r\n%%\r\nassert(isequal(tautology('((A|0)\u00261)\u0026~B'),false)); \r\n%%\r\nassert(isequal(tautology('((A|A)\u0026A)|~A'),true)); \r\n%%\r\nassert(isequal(tautology('((B|0)\u0026B)'),false)); \r\n%%\r\nassert(isequal(tautology('((B|1)\u0026B)\u0026A'),false)); \r\n%%\r\nassert(isequal(tautology('((B|A)|~A)'),true)); \r\n%%\r\nassert(isequal(tautology('((~A\u0026~A)\u00260)\u0026B'),false)); \r\n%%\r\nassert(isequal(tautology('((~A\u0026~A)|0)'),false)); \r\n%%\r\nassert(isequal(tautology('((~A\u0026~A)|~A)|1'),true)); \r\n%%\r\nassert(isequal(tautology('((~A|A)|~B)\u00261'),true)); \r\n%%\r\nassert(isequal(tautology('((~A|B)|A)'),true)); \r\n%%\r\nassert(isequal(tautology('((~A|~A)|1)'),true)); \r\n%%\r\nassert(isequal(tautology('((~A|~B)\u00260)'),false)); \r\n%%\r\nassert(isequal(tautology('((~B\u00260)\u0026A)'),false)); \r\n%%\r\nassert(isequal(tautology('(0\u00261)|1\u00261'),true)); \r\n%%\r\nassert(isequal(tautology('(0|~A\u0026B)'),false)); \r\n%%\r\nassert(isequal(tautology('(1|A\u00260)'),true)); \r\n%%\r\nassert(isequal(tautology('(A\u0026A\u0026~B)'),false)); \r\n%%\r\nassert(isequal(tautology('(A\u0026~A|1)'),true)); \r\n%%\r\nassert(isequal(tautology('(A|1)|B'),true)); \r\n%%\r\nassert(isequal(tautology('(A|A)|A|1'),true)); \r\n%%\r\nassert(isequal(tautology('(B\u00261)|~B'),true)); \r\n%%\r\nassert(isequal(tautology('(B\u0026~B)\u0026~B\u00260'),false)); \r\n%%\r\nassert(isequal(tautology('(B|~B)|B'),true)); \r\n%%\r\nassert(isequal(tautology('(~A\u0026B\u00260)'),false)); \r\n%%\r\nassert(isequal(tautology('(~A|0)|~B\u0026~A'),false)); \r\n%%\r\nassert(isequal(tautology('(~A|1)|1'),true)); \r\n%%\r\nassert(isequal(tautology('(~A|B\u0026B)'),false)); \r\n%%\r\nassert(isequal(tautology('(~A|B)|~B'),true)); \r\n%%\r\nassert(isequal(tautology('(~A|~A)|0'),false)); \r\n%%\r\nassert(isequal(tautology('(~B\u00260)\u00261|1'),true)); \r\n%%\r\nassert(isequal(tautology('1\u0026B|~B|0'),true)); \r\n%%\r\nassert(isequal(tautology('B\u00261\u0026A\u00261'),false)); \r\n%%\r\nassert(isequal(tautology('~A\u00260\u00261|1'),true)); \r\n%%\r\nassert(isequal(tautology('~B\u00260\u0026~A|B'),false)); \r\n%%\r\nassert(isequal(tautology('~B|1|1|~B'),true)); \r\n%%\r\nassert(isequal(tautology('~B|~B\u00261|1'),true));\r\n%%\r\nassert(isequal(tautology('A==~A'),false));\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":30,"created_by":14358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":44,"test_suite_updated_at":"2017-10-31T07:45:16.000Z","rescore_all_solutions":true,"group_id":35,"created_at":"2017-10-10T23:20:08.000Z","updated_at":"2026-02-03T08:59:32.000Z","published_at":"2017-10-16T01:51:01.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\u003eCheck if the given expression is always true. For example, 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['~(A \u0026 B) == (~A | ~B)']]\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 always true.\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\u003eCharacters in the input sequences may include\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\u003e~ \u0026amp; | == ( )\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, whitespace, 0 for false, 1 for true and letters for variables.\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":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":518,"title":"English to Pig Latin Translator","description":"Pig latin is a faux-language based off of English. The rules are as follows (excerpted from the wikipedia entry for Pig Latin):\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 english (may be multiple words), produce the Pig Latin version.","description_html":"\u003cp\u003ePig latin is a faux-language based off of English. The rules are as follows (excerpted from the wikipedia entry for Pig Latin):\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\u003cul\u003e\u003cli\u003ehappy → appy-hay\u003c/li\u003e\u003cli\u003equestion → estion-quay\u003c/li\u003e\u003c/ul\u003e\u003cp\u003e2. In words that begin with vowels, the syllable \"ay\" is simply added to the end of the word.\u003c/p\u003e\u003cul\u003e\u003cli\u003eanother → another-ay\u003c/li\u003e\u003cli\u003eabout → about-ay\u003c/li\u003e\u003c/ul\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 english (may be multiple words), produce the Pig Latin version.\u003c/p\u003e","function_template":"function p = english2piglatin( e )\r\n  p = e;\r\nend","test_suite":"%%\r\nstr1 = 'question';\r\nstr2 = 'estion-quay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'another';\r\nstr2 = 'another-ay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'nix';\r\nstr2 = 'ix-nay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'another one bites the dust';\r\nstr2 = 'another-ay one-ay ites-bay e-thay ust-day';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'how much wood would a woodchuck chuck if a woodchuck could chuck wood';\r\nstr2 = '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\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'peter piper picked a peck of pickle peppers';\r\nstr2 = 'eter-pay iper-pay icked-pay a-ay eck-pay of-ay ickle-pay eppers-pay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))\r\n\r\n%%\r\nstr1 = 'four score';\r\nstr2 = 'our-fay ore-scay';\r\nstr1_f = english2piglatin(str1);\r\nassert(strcmp(str1_f,str2))","published":true,"deleted":false,"likes_count":1,"comments_count":3,"created_by":134,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":161,"test_suite_updated_at":"2016-12-12T17:54:21.000Z","rescore_all_solutions":false,"group_id":14,"created_at":"2012-03-22T14:56:07.000Z","updated_at":"2026-03-15T00:58:42.000Z","published_at":"2012-03-22T15:02: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\u003ePig latin is a faux-language based off of English. The rules are as follows (excerpted from the wikipedia entry for Pig Latin):\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003ehappy → appy-hay\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\u003equestion → estion-quay\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=\\\"ListParagraph\\\"/\u003e\u003cw:numPr\u003e\u003cw:numId w:val=\\\"1\\\"/\u003e\u003c/w:numPr\u003e\u003c/w:pPr\u003e\u003cw:r\u003e\u003cw:t\u003eanother → another-ay\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\u003eabout → about-ay\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 english (may be multiple words), produce the Pig Latin 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":44374,"title":"Tautology","description":"Check if the given expression is always true. For example, the sentence\r\n\r\n  '~(A \u0026 B) == (~A | ~B)'\r\n\r\nis always true.\r\n\r\nCharacters in the input sequences may include *~ \u0026 | == ( )*, whitespace, 0 for false, 1 for true and letters for variables.","description_html":"\u003cp\u003eCheck if the given expression is always true. For example, the sentence\u003c/p\u003e\u003cpre class=\"language-matlab\"\u003e'~(A \u0026 B) == (~A | ~B)'\r\n\u003c/pre\u003e\u003cp\u003eis always true.\u003c/p\u003e\u003cp\u003eCharacters in the input sequences may include \u003cb\u003e~ \u0026 | == ( )\u003c/b\u003e, whitespace, 0 for false, 1 for true and letters for variables.\u003c/p\u003e","function_template":"function y = tautology(x)\r\n  y = true;\r\nend","test_suite":"%%\r\nx = '0';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '1';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '~A';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|1';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '1\u0026A';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|B';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A\u0026B';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|A';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|~A';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '0==0';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '~0';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '~(A \u0026 B) == (~A | ~B)';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = '~(Z \u0026 Y) == (~Y | ~Z)';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|X|V|W|Y|Z';\r\ny_correct = false;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nx = 'A|B|C|D|E|F|G|H|I|J|K|L|M|~A|O|P|Q|R|S|T|U|X|V|W|Y|Z';\r\ny_correct = true;\r\nassert(isequal(tautology(x),y_correct))\r\n%%\r\nassert(isequal(tautology('(A|B)|C'),false));\r\n%%\r\nassert(isequal(tautology('(A|B)|(C == C)'),true));\r\n%%\r\nassert(isequal(tautology('(A == B)|(B == C)|(C == A)'),true));\r\n%%\r\nassert(isequal(tautology('~(~(~(~(~(~(0))))))'),false)); \r\n%%\r\nassert(isequal(tautology('~(~(~(~(~(~(~0))))))'),true));\r\n% provided by Alfonso:\r\nassert(isequal(tautology('((0\u00261)|~B)\u0026~B'),false)); \r\n%%\r\nassert(isequal(tautology('((0\u0026~B)\u0026~B)'),false)); \r\n%%\r\nassert(isequal(tautology('((0|A)\u0026~A)'),false)); \r\n%%\r\nassert(isequal(tautology('((0|A)|1)'),true)); \r\n%%\r\nassert(isequal(tautology('((0|~B)|1)'),true)); \r\n%%\r\nassert(isequal(tautology('((1\u00260)|B)'),false)); \r\n%%\r\nassert(isequal(tautology('((1\u00261)\u0026A)'),false)); \r\n%%\r\nassert(isequal(tautology('((1|0)|A)'),true)); \r\n%%\r\nassert(isequal(tautology('((1|A)|0)'),true)); \r\n%%\r\nassert(isequal(tautology('((1|~A)\u0026B)'),false)); \r\n%%\r\nassert(isequal(tautology('((A\u00261)|~A)|A'),true)); \r\n%%\r\nassert(isequal(tautology('((A\u0026~A)\u0026~B)|~A'),false)); \r\n%%\r\nassert(isequal(tautology('((A\u0026~B)\u00261)|B'),false)); \r\n%%\r\nassert(isequal(tautology('((A|0)\u00261)\u0026~B'),false)); \r\n%%\r\nassert(isequal(tautology('((A|A)\u0026A)|~A'),true)); \r\n%%\r\nassert(isequal(tautology('((B|0)\u0026B)'),false)); \r\n%%\r\nassert(isequal(tautology('((B|1)\u0026B)\u0026A'),false)); \r\n%%\r\nassert(isequal(tautology('((B|A)|~A)'),true)); \r\n%%\r\nassert(isequal(tautology('((~A\u0026~A)\u00260)\u0026B'),false)); \r\n%%\r\nassert(isequal(tautology('((~A\u0026~A)|0)'),false)); \r\n%%\r\nassert(isequal(tautology('((~A\u0026~A)|~A)|1'),true)); \r\n%%\r\nassert(isequal(tautology('((~A|A)|~B)\u00261'),true)); \r\n%%\r\nassert(isequal(tautology('((~A|B)|A)'),true)); \r\n%%\r\nassert(isequal(tautology('((~A|~A)|1)'),true)); \r\n%%\r\nassert(isequal(tautology('((~A|~B)\u00260)'),false)); \r\n%%\r\nassert(isequal(tautology('((~B\u00260)\u0026A)'),false)); \r\n%%\r\nassert(isequal(tautology('(0\u00261)|1\u00261'),true)); \r\n%%\r\nassert(isequal(tautology('(0|~A\u0026B)'),false)); \r\n%%\r\nassert(isequal(tautology('(1|A\u00260)'),true)); \r\n%%\r\nassert(isequal(tautology('(A\u0026A\u0026~B)'),false)); \r\n%%\r\nassert(isequal(tautology('(A\u0026~A|1)'),true)); \r\n%%\r\nassert(isequal(tautology('(A|1)|B'),true)); \r\n%%\r\nassert(isequal(tautology('(A|A)|A|1'),true)); \r\n%%\r\nassert(isequal(tautology('(B\u00261)|~B'),true)); \r\n%%\r\nassert(isequal(tautology('(B\u0026~B)\u0026~B\u00260'),false)); \r\n%%\r\nassert(isequal(tautology('(B|~B)|B'),true)); \r\n%%\r\nassert(isequal(tautology('(~A\u0026B\u00260)'),false)); \r\n%%\r\nassert(isequal(tautology('(~A|0)|~B\u0026~A'),false)); \r\n%%\r\nassert(isequal(tautology('(~A|1)|1'),true)); \r\n%%\r\nassert(isequal(tautology('(~A|B\u0026B)'),false)); \r\n%%\r\nassert(isequal(tautology('(~A|B)|~B'),true)); \r\n%%\r\nassert(isequal(tautology('(~A|~A)|0'),false)); \r\n%%\r\nassert(isequal(tautology('(~B\u00260)\u00261|1'),true)); \r\n%%\r\nassert(isequal(tautology('1\u0026B|~B|0'),true)); \r\n%%\r\nassert(isequal(tautology('B\u00261\u0026A\u00261'),false)); \r\n%%\r\nassert(isequal(tautology('~A\u00260\u00261|1'),true)); \r\n%%\r\nassert(isequal(tautology('~B\u00260\u0026~A|B'),false)); \r\n%%\r\nassert(isequal(tautology('~B|1|1|~B'),true)); \r\n%%\r\nassert(isequal(tautology('~B|~B\u00261|1'),true));\r\n%%\r\nassert(isequal(tautology('A==~A'),false));\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n","published":true,"deleted":false,"likes_count":3,"comments_count":30,"created_by":14358,"edited_by":null,"edited_at":null,"deleted_by":null,"deleted_at":null,"solvers_count":44,"test_suite_updated_at":"2017-10-31T07:45:16.000Z","rescore_all_solutions":true,"group_id":35,"created_at":"2017-10-10T23:20:08.000Z","updated_at":"2026-02-03T08:59:32.000Z","published_at":"2017-10-16T01:51:01.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\u003eCheck if the given expression is always true. For example, 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['~(A \u0026 B) == (~A | ~B)']]\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 always true.\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\u003eCharacters in the input sequences may include\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\u003e~ \u0026amp; | == ( )\u003c/w:t\u003e\u003c/w:r\u003e\u003cw:r\u003e\u003cw:t\u003e, whitespace, 0 for false, 1 for true and letters for variables.\u003c/w:t\u003e\u003c/w:r\u003e\u003c/w:p\u003e\u003c/w:body\u003e\u003c/w:document\u003e\"},{\"partUri\":\"/matlab/output.xml\",\"contentType\":\"text/xml\",\"content\":\"\u003c?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"no\\\" ?\u003e\u003cembeddedOutputs\u003e\u003cmetaData\u003e\u003cevaluationState\u003emanual\u003c/evaluationState\u003e\u003clayoutState\u003ecode\u003c/layoutState\u003e\u003coutputStatus\u003eready\u003c/outputStatus\u003e\u003c/metaData\u003e\u003coutputArray type=\\\"array\\\"/\u003e\u003cregionArray type=\\\"array\\\"/\u003e\u003c/embeddedOutputs\u003e\"}]}"}],"term":"tag:\"regular expressions\"","current_player_id":null,"fields":[{"name":"page","type":"integer","callback":null,"default":1,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"per_page","type":"integer","callback":null,"default":50,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"sort","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":null,"prepend":true},{"name":"body","type":"text","callback":null,"default":"*:*","directive":null,"facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":false},{"name":"group","type":"string","callback":null,"default":null,"directive":"group","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"difficulty_rating_bin","type":"string","callback":null,"default":null,"directive":"difficulty_rating_bin","facet":true,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"id","type":"integer","callback":null,"default":null,"directive":"id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"tag","type":"string","callback":null,"default":null,"directive":"tag","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"product","type":"string","callback":null,"default":null,"directive":"product","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_at","type":"timeframe","callback":{},"default":null,"directive":"created_at","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"profile_id","type":"integer","callback":null,"default":null,"directive":"author_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"created_by","type":"string","callback":null,"default":null,"directive":"author","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player_id","type":"integer","callback":null,"default":null,"directive":"solver_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"player","type":"string","callback":null,"default":null,"directive":"solver","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"solvers_count","type":"integer","callback":null,"default":null,"directive":"solvers_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"comments_count","type":"integer","callback":null,"default":null,"directive":"comments_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"likes_count","type":"integer","callback":null,"default":null,"directive":"likes_count","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leader_id","type":"integer","callback":null,"default":null,"directive":"leader_id","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true},{"name":"leading_solution","type":"integer","callback":null,"default":null,"directive":"leading_solution","facet":null,"facet_method":"and","operator":null,"param":"term","static":null,"prepend":true}],"filters":[{"name":"asset_type","type":"string","callback":null,"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":null,"static":"\"cody:problem\"","prepend":true},{"name":"profile_id","type":"integer","callback":{},"default":null,"directive":null,"facet":null,"facet_method":"and","operator":null,"param":"author_id","static":null,"prepend":true}],"query":{"params":{"per_page":50,"term":"tag:\"regular expressions\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"regular expressions\"","","\"","regular expressions","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f69f208a328\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f69f208a288\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f69f20899c8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f69f208a5a8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f69f208a508\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f69f208a468\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f69f208a3c8\u003e":"tag:\"regular expressions\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f69f208a3c8\u003e":"tag:\"regular expressions\""},"queried_facets":{}},"query_backend":{"connection":{"configuration":{"index_url":"http://index-op-v2/solr/","query_url":"http://search-op-v2/solr/","direct_access_index_urls":["http://index-op-v2/solr/"],"direct_access_query_urls":["http://search-op-v2/solr/"],"timeout":10,"vhost":"search","exchange":"search.topic","heartbeat":30,"pre_index_mode":false,"host":"rabbitmq-eks","port":5672,"username":"cody-search","password":"78X075ddcV44","virtual_host":"search","indexer":"amqp","http_logging":"true","core":"cody"},"query_connection":{"uri":"http://search-op-v2/solr/cody/","proxy":null,"connection":{"parallel_manager":null,"headers":{"User-Agent":"Faraday v1.0.1"},"params":{},"options":{"params_encoder":"Faraday::FlatParamsEncoder","proxy":null,"bind":null,"timeout":null,"open_timeout":null,"read_timeout":null,"write_timeout":null,"boundary":null,"oauth":null,"context":null,"on_data":null},"ssl":{"verify":true,"ca_file":null,"ca_path":null,"verify_mode":null,"cert_store":null,"client_cert":null,"client_key":null,"certificate":null,"private_key":null,"verify_depth":null,"version":null,"min_version":null,"max_version":null},"default_parallel_manager":null,"builder":{"adapter":{"name":"Faraday::Adapter::NetHttp","args":[],"block":null},"handlers":[{"name":"Faraday::Response::RaiseError","args":[],"block":null}],"app":{"app":{"ssl_cert_store":{"verify_callback":null,"error":null,"error_string":null,"chain":null,"time":null},"app":{},"connection_options":{},"config_block":null}}},"url_prefix":"http://search-op-v2/solr/cody/","manual_proxy":false,"proxy":null},"update_format":"RSolr::JSON::Generator","update_path":"update","options":{"url":"http://search-op-v2/solr/cody"}}},"query":{"params":{"per_page":50,"term":"tag:\"regular expressions\"","current_player":null,"sort":"map(difficulty_value,0,0,999) asc"},"parser":"MathWorks::Search::Solr::QueryParser","directives":{"term":{"directives":{"tag":[["tag:\"regular expressions\"","","\"","regular expressions","\""]]}}},"facets":{"#\u003cMathWorks::Search::Field:0x00007f69f208a328\u003e":null,"#\u003cMathWorks::Search::Field:0x00007f69f208a288\u003e":null},"filters":{"#\u003cMathWorks::Search::Field:0x00007f69f20899c8\u003e":"\"cody:problem\""},"fields":{"#\u003cMathWorks::Search::Field:0x00007f69f208a5a8\u003e":1,"#\u003cMathWorks::Search::Field:0x00007f69f208a508\u003e":50,"#\u003cMathWorks::Search::Field:0x00007f69f208a468\u003e":"map(difficulty_value,0,0,999) asc","#\u003cMathWorks::Search::Field:0x00007f69f208a3c8\u003e":"tag:\"regular expressions\""},"user_query":{"#\u003cMathWorks::Search::Field:0x00007f69f208a3c8\u003e":"tag:\"regular expressions\""},"queried_facets":{}},"options":{"fields":["id","difficulty_rating"]},"join":" "},"results":[{"id":519,"difficulty_rating":"medium"},{"id":518,"difficulty_rating":"medium"},{"id":44374,"difficulty_rating":"medium-hard"}]}}