Cody

# Problem 1124. String permutations on phone keyboard

Solution 178729

Submitted on 18 Dec 2012 by Aurelien Queffurust
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
%% x = 2639; y_correct = {'amdw';'amdx';'amdy';'amdz';'amew';'amex';'amey';'amez';'amfw';'amfx';'amfy';'amfz';'andw';'andx';'andy';'andz';'anew';'anex';'aney';'anez';'anfw';'anfx';'anfy';'anfz';'aodw';'aodx';'aody';'aodz';'aoew';'aoex';'aoey';'aoez';'aofw';'aofx';'aofy';'aofz';'bmdw';'bmdx';'bmdy';'bmdz';'bmew';'bmex';'bmey';'bmez';'bmfw';'bmfx';'bmfy';'bmfz';'bndw';'bndx';'bndy';'bndz';'bnew';'bnex';'bney';'bnez';'bnfw';'bnfx';'bnfy';'bnfz';'bodw';'bodx';'body';'bodz';'boew';'boex';'boey';'boez';'bofw';'bofx';'bofy';'bofz';'cmdw';'cmdx';'cmdy';'cmdz';'cmew';'cmex';'cmey';'cmez';'cmfw';'cmfx';'cmfy';'cmfz';'cndw';'cndx';'cndy';'cndz';'cnew';'cnex';'cney';'cnez';'cnfw';'cnfx';'cnfy';'cnfz';'codw';'codx';'cody';'codz';'coew';'coex';'coey';'coez';'cofw';'cofx';'cofy';'cofz';}; assert(isequal(string_perms(x),y_correct))

``` ascii = ABCDEFGHIJKLMNOPQRSTUVWXYZ score = Columns 1 through 16 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 Columns 17 through 26 7 7 7 8 8 8 9 9 9 9 str = [] y = 2 6 3 9 R1 = ABC R2 = MNO R3 = DEF R4 = WXYZ str = amdw str = amdw amdx str = amdw amdx amdy str = amdw amdx amdy amdz str = amdw amdx amdy amdz amew str = amdw amdx amdy amdz amew amex str = amdw amdx amdy amdz amew amex amey str = amdw amdx amdy amdz amew amex amey amez str = amdw amdx amdy amdz amew amex amey amez amfw str = amdw amdx amdy amdz amew amex amey amez amfw amfx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz bnew str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz bnew bnex str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz bnew bnex bney str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz bnew bnex bney bnez str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz bnew bnex bney bnez bnfw str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz bnew bnex bney bnez bnfw bnfx str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz bnew bnex bney bnez bnfw bnfx bnfy str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey aoez aofw aofx aofy aofz bmdw bmdx bmdy bmdz bmew bmex bmey bmez bmfw bmfx bmfy bmfz bndw bndx bndy bndz bnew bnex bney bnez bnfw bnfx bnfy bnfz str = amdw amdx amdy amdz amew amex amey amez amfw amfx amfy amfz andw andx andy andz anew anex aney anez anfw anfx anfy anfz aodw aodx aody aodz aoew aoex aoey ...```