Cody

Solution 1767024

Submitted on 30 Mar 2019 by William
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
str = 'america'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

2   Pass
str = 'claire'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

3   Pass
str = 'natick'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

4   Pass
str = 'consciousness'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

5   Pass
str = 'alice'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

6   Pass
str = 'lunatic'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

7   Pass
str = 'bananacreampies'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

8   Pass
str = 'heyyouupinthesky'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

9   Pass
str = 'frames'; allElements = { ... 'Ac','Al','Am','Sb','Ar','As','At','Ba','Bk','Be','Bi','Bh','B','Br','Cd', ... 'Ca','Cf','C','Ce','Cs','Cl','Cr','Co','Cu','Cm','Ds','Db','Dy','Es', ... 'Er','Eu','Fm','F','Fr','Gd','Ga','Ge','Au','Hf','Hs','He','Ho','H', ... 'In','I','Ir','Fe','Kr','La','Lr','Pb','Li','Lu','Mg','Mn','Mt','Md', ... 'Hg','Mo','Nd','Ne','Np','Ni','Nb','N','No','Os','O','Pd','P','Pt','Pu', ... 'Po','K','Pr','Pm','Pa','Ra','Rn','Re','Rh','Rg','Rb','Ru','Rf','Sm', ... 'Sc','Sg','Se','Si','Ag','Na','Sr','S','Ta','Tc','Te','Tb','Tl','Th', ... 'Tm','Sn','Ti','W','Uub','Uuh','Uuo','Uup','Uuq','Uus','Uut','Uuu','U', ... 'V','Xe','Yb','Y','Zn','Zr'}; answer = spellWithElements(str); answer = lower(answer); allElements = lower(allElements); assert(isempty(setdiff(answer,allElements))) assert(isequal(sprintf('%s',answer{:}),str))

Suggested Problems

More from this Author63