Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 105729

Submitted on 3 Jul 2012 by Aurelien Queffurust

Correct

62Size
Leading solution size is 12.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
s='ThE qUiCk BrOwN fOx JuMpEd OvEr ThE lAzY dOg';
se = 'YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;SxU fPh';
assert(isequal(Qwerty_encode(s),se))
encoded_str =
     []
su =
snvfrghjokl;,mp[wtdyibecuxSNVFRGHJOKL:<MP{WTDYIBECUX
t =
T
r =
    46
encoded_str =
Y
t =
h
r =
     8
encoded_str =
Yj
t =
E
r =
    31
encoded_str =
YjR
t =
r =
    53
encoded_str =
YjR
t =
q
r =
    17
encoded_str =
YjR w
t =
U
r =
    47
encoded_str =
YjR wI
t =
i
r =
     9
encoded_str =
YjR wIo
t =
C
r =
    29
encoded_str =
YjR wIoV
t =
k
r =
    11
encoded_str =
YjR wIoVl
t =
r =
    53
encoded_str =
YjR wIoVl
t =
B
r =
    28
encoded_str =
YjR wIoVl N
t =
r
r =
    18
encoded_str =
YjR wIoVl Nt
t =
O
r =
    41
encoded_str =
YjR wIoVl NtP
t =
w
r =
    23
encoded_str =
YjR wIoVl NtPe
t =
N
r =
    40
encoded_str =
YjR wIoVl NtPeM
t =
r =
    53
encoded_str =
YjR wIoVl NtPeM
t =
f
r =
     6
encoded_str =
YjR wIoVl NtPeM g
t =
O
r =
    41
encoded_str =
YjR wIoVl NtPeM gP
t =
x
r =
    24
encoded_str =
YjR wIoVl NtPeM gPc
t =
r =
    53
encoded_str =
YjR wIoVl NtPeM gPc
t =
J
r =
    36
encoded_str =
YjR wIoVl NtPeM gPc K
t =
u
r =
    21
encoded_str =
YjR wIoVl NtPeM gPc Ki
t =
M
r =
    39
encoded_str =
YjR wIoVl NtPeM gPc Ki<
t =
p
r =
    16
encoded_str =
YjR wIoVl NtPeM gPc Ki<[
t =
E
r =
    31
encoded_str =
YjR wIoVl NtPeM gPc Ki<[R
t =
d
r =
     4
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf
t =
r =
    53
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf
t =
O
r =
    41
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf P
t =
v
r =
    22
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf Pb
t =
E
r =
    31
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbR
t =
r
r =
    18
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt
t =
r =
    53
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt
t =
T
r =
    46
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt Y
t =
h
r =
     8
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt Yj
t =
E
r =
    31
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR
t =
r =
    53
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR
t =
l
r =
    12
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;
t =
A
r =
    27
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;S
t =
z
r =
    26
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;Sx
t =
Y
r =
    51
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;SxU
t =
r =
    53
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;SxU
t =
d
r =
     4
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;SxU f
t =
O
r =
    41
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;SxU fP
t =
g
r =
     7
encoded_str =
YjR wIoVl NtPeM gPc Ki<[Rf PbRt YjR ;SxU fPh
2
Pass
 
%%
s='abcdefghijklmnopqrstuvwxyz';
se='snvfrghjokl;,mp[wtdyibecux'; % a-z
assert(isequal(Qwerty_encode(s),se))
encoded_str =
     []
su =
snvfrghjokl;,mp[wtdyibecuxSNVFRGHJOKL:<MP{WTDYIBECUX
t =
a
r =
     1
encoded_str =
s
t =
b
r =
     2
encoded_str =
sn
t =
c
r =
     3
encoded_str =
snv
t =
d
r =
     4
encoded_str =
snvf
t =
e
r =
     5
encoded_str =
snvfr
t =
f
r =
     6
encoded_str =
snvfrg
t =
g
r =
     7
encoded_str =
snvfrgh
t =
h
r =
     8
encoded_str =
snvfrghj
t =
i
r =
     9
encoded_str =
snvfrghjo
t =
j
r =
    10
encoded_str =
snvfrghjok
t =
k
r =
    11
encoded_str =
snvfrghjokl
t =
l
r =
    12
encoded_str =
snvfrghjokl;
t =
m
r =
    13
encoded_str =
snvfrghjokl;,
t =
n
r =
    14
encoded_str =
snvfrghjokl;,m
t =
o
r =
    15
encoded_str =
snvfrghjokl;,mp
t =
p
r =
    16
encoded_str =
snvfrghjokl;,mp[
t =
q
r =
    17
encoded_str =
snvfrghjokl;,mp[w
t =
r
r =
    18
encoded_str =
snvfrghjokl;,mp[wt
t =
s
r =
    19
encoded_str =
snvfrghjokl;,mp[wtd
t =
t
r =
    20
encoded_str =
snvfrghjokl;,mp[wtdy
t =
u
r =
    21
encoded_str =
snvfrghjokl;,mp[wtdyi
t =
v
r =
    22
encoded_str =
snvfrghjokl;,mp[wtdyib
t =
w
r =
    23
encoded_str =
snvfrghjokl;,mp[wtdyibe
t =
x
r =
    24
encoded_str =
snvfrghjokl;,mp[wtdyibec
t =
y
r =
    25
encoded_str =
snvfrghjokl;,mp[wtdyibecu
t =
z
r =
    26
encoded_str =
snvfrghjokl;,mp[wtdyibecux
3
Pass
 
%%
s='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
se='SNVFRGHJOKL:<MP{WTDYIBECUX'; % A-Z
assert(isequal(Qwerty_encode(s),se))
encoded_str =
     []
su =
snvfrghjokl;,mp[wtdyibecuxSNVFRGHJOKL:<MP{WTDYIBECUX
t =
A
r =
    27
encoded_str =
S
t =
B
r =
    28
encoded_str =
SN
t =
C
r =
    29
encoded_str =
SNV
t =
D
r =
    30
encoded_str =
SNVF
t =
E
r =
    31
encoded_str =
SNVFR
t =
F
r =
    32
encoded_str =
SNVFRG
t =
G
r =
    33
encoded_str =
SNVFRGH
t =
H
r =
    34
encoded_str =
SNVFRGHJ
t =
I
r =
    35
encoded_str =
SNVFRGHJO
t =
J
r =
    36
encoded_str =
SNVFRGHJOK
t =
K
r =
    37
encoded_str =
SNVFRGHJOKL
t =
L
r =
    38
encoded_str =
SNVFRGHJOKL:
t =
M
r =
    39
encoded_str =
SNVFRGHJOKL:<
t =
N
r =
    40
encoded_str =
SNVFRGHJOKL:<M
t =
O
r =
    41
encoded_str =
SNVFRGHJOKL:<MP
t =
P
r =
    42
encoded_str =
SNVFRGHJOKL:<MP{
t =
Q
r =
    43
encoded_str =
SNVFRGHJOKL:<MP{W
t =
R
r =
    44
encoded_str =
SNVFRGHJOKL:<MP{WT
t =
S
r =
    45
encoded_str =
SNVFRGHJOKL:<MP{WTD
t =
T
r =
    46
encoded_str =
SNVFRGHJOKL:<MP{WTDY
t =
U
r =
    47
encoded_str =
SNVFRGHJOKL:<MP{WTDYI
t =
V
r =
    48
encoded_str =
SNVFRGHJOKL:<MP{WTDYIB
t =
W
r =
    49
encoded_str =
SNVFRGHJOKL:<MP{WTDYIBE
t =
X
r =
    50
encoded_str =
SNVFRGHJOKL:<MP{WTDYIBEC
t =
Y
r =
    51
encoded_str =
SNVFRGHJOKL:<MP{WTDYIBECU
t =
Z
r =
    52
encoded_str =
SNVFRGHJOKL:<MP{WTDYIBECUX
4
Pass
 
%%
s='You miss 100 percent of the shots you never take. Gretzky';
se='Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr. Htryxlu';
assert(isequal(Qwerty_encode(s),se))
encoded_str =
     []
su =
snvfrghjokl;,mp[wtdyibecuxSNVFRGHJOKL:<MP{WTDYIBECUX
t =
Y
r =
    51
encoded_str =
U
t =
o
r =
    15
encoded_str =
Up
t =
u
r =
    21
encoded_str =
Upi
t =
r =
    53
encoded_str =
Upi
t =
m
r =
    13
encoded_str =
Upi ,
t =
i
r =
     9
encoded_str =
Upi ,o
t =
s
r =
    19
encoded_str =
Upi ,od
t =
s
r =
    19
encoded_str =
Upi ,odd
t =
r =
    53
encoded_str =
Upi ,odd
t =
   Empty string: 1-by-0
r =
   Empty matrix: 1-by-0
encoded_str =
Upi ,odd 1
t =
   Empty string: 1-by-0
r =
   Empty matrix: 1-by-0
encoded_str =
Upi ,odd 10
t =
   Empty string: 1-by-0
r =
   Empty matrix: 1-by-0
encoded_str =
Upi ,odd 100
t =
r =
    53
encoded_str =
Upi ,odd 100
t =
p
r =
    16
encoded_str =
Upi ,odd 100 [
t =
e
r =
     5
encoded_str =
Upi ,odd 100 [r
t =
r
r =
    18
encoded_str =
Upi ,odd 100 [rt
t =
c
r =
     3
encoded_str =
Upi ,odd 100 [rtv
t =
e
r =
     5
encoded_str =
Upi ,odd 100 [rtvr
t =
n
r =
    14
encoded_str =
Upi ,odd 100 [rtvrm
t =
t
r =
    20
encoded_str =
Upi ,odd 100 [rtvrmy
t =
r =
    53
encoded_str =
Upi ,odd 100 [rtvrmy
t =
o
r =
    15
encoded_str =
Upi ,odd 100 [rtvrmy p
t =
f
r =
     6
encoded_str =
Upi ,odd 100 [rtvrmy pg
t =
r =
    53
encoded_str =
Upi ,odd 100 [rtvrmy pg
t =
t
r =
    20
encoded_str =
Upi ,odd 100 [rtvrmy pg y
t =
h
r =
     8
encoded_str =
Upi ,odd 100 [rtvrmy pg yj
t =
e
r =
     5
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr
t =
r =
    53
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr
t =
s
r =
    19
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr d
t =
h
r =
     8
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr dj
t =
o
r =
    15
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djp
t =
t
r =
    20
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpy
t =
s
r =
    19
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd
t =
r =
    53
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd
t =
y
r =
    25
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd u
t =
o
r =
    15
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd up
t =
u
r =
    21
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi
t =
r =
    53
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi
t =
n
r =
    14
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi m
t =
e
r =
     5
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mr
t =
v
r =
    22
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrb
t =
e
r =
     5
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbr
t =
r
r =
    18
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt
t =
r =
    53
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt
t =
t
r =
    20
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt y
t =
a
r =
     1
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt ys
t =
k
r =
    11
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt ysl
t =
e
r =
     5
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr
t =
   Empty string: 1-by-0
r =
   Empty matrix: 1-by-0
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr.
t =
r =
    53
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr.
t =
G
r =
    33
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr. H
t =
r
r =
    18
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr. Ht
t =
e
r =
     5
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr. Htr
t =
t
r =
    20
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr. Htry
t =
z
r =
    26
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr. Htryx
t =
k
r =
    11
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr. Htryxl
t =
y
r =
    25
encoded_str =
Upi ,odd 100 [rtvrmy pg yjr djpyd upi mrbrt yslr. Htryxlu
5
Pass
 
%%
s='Those who believe in telekinetics raise my hand. Vonnegut';
se='Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. Bpmmrhiy';
assert(isequal(Qwerty_encode(s),se))
encoded_str =
     []
su =
snvfrghjokl;,mp[wtdyibecuxSNVFRGHJOKL:<MP{WTDYIBECUX
t =
T
r =
    46
encoded_str =
Y
t =
h
r =
     8
encoded_str =
Yj
t =
o
r =
    15
encoded_str =
Yjp
t =
s
r =
    19
encoded_str =
Yjpd
t =
e
r =
     5
encoded_str =
Yjpdr
t =
r =
    53
encoded_str =
Yjpdr
t =
w
r =
    23
encoded_str =
Yjpdr e
t =
h
r =
     8
encoded_str =
Yjpdr ej
t =
o
r =
    15
encoded_str =
Yjpdr ejp
t =
r =
    53
encoded_str =
Yjpdr ejp
t =
b
r =
     2
encoded_str =
Yjpdr ejp n
t =
e
r =
     5
encoded_str =
Yjpdr ejp nr
t =
l
r =
    12
encoded_str =
Yjpdr ejp nr;
t =
i
r =
     9
encoded_str =
Yjpdr ejp nr;o
t =
e
r =
     5
encoded_str =
Yjpdr ejp nr;or
t =
v
r =
    22
encoded_str =
Yjpdr ejp nr;orb
t =
e
r =
     5
encoded_str =
Yjpdr ejp nr;orbr
t =
r =
    53
encoded_str =
Yjpdr ejp nr;orbr
t =
i
r =
     9
encoded_str =
Yjpdr ejp nr;orbr o
t =
n
r =
    14
encoded_str =
Yjpdr ejp nr;orbr om
t =
r =
    53
encoded_str =
Yjpdr ejp nr;orbr om
t =
t
r =
    20
encoded_str =
Yjpdr ejp nr;orbr om y
t =
e
r =
     5
encoded_str =
Yjpdr ejp nr;orbr om yr
t =
l
r =
    12
encoded_str =
Yjpdr ejp nr;orbr om yr;
t =
e
r =
     5
encoded_str =
Yjpdr ejp nr;orbr om yr;r
t =
k
r =
    11
encoded_str =
Yjpdr ejp nr;orbr om yr;rl
t =
i
r =
     9
encoded_str =
Yjpdr ejp nr;orbr om yr;rlo
t =
n
r =
    14
encoded_str =
Yjpdr ejp nr;orbr om yr;rlom
t =
e
r =
     5
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomr
t =
t
r =
    20
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomry
t =
i
r =
     9
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryo
t =
c
r =
     3
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryov
t =
s
r =
    19
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd
t =
r =
    53
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd
t =
r
r =
    18
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd t
t =
a
r =
     1
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd ts
t =
i
r =
     9
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tso
t =
s
r =
    19
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsod
t =
e
r =
     5
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr
t =
r =
    53
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr
t =
m
r =
    13
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,
t =
y
r =
    25
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u
t =
r =
    53
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u
t =
h
r =
     8
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u j
t =
a
r =
     1
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u js
t =
n
r =
    14
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsm
t =
d
r =
     4
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf
t =
   Empty string: 1-by-0
r =
   Empty matrix: 1-by-0
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf.
t =
r =
    53
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf.
t =
V
r =
    48
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. B
t =
o
r =
    15
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. Bp
t =
n
r =
    14
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. Bpm
t =
n
r =
    14
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. Bpmm
t =
e
r =
     5
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. Bpmmr
t =
g
r =
     7
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. Bpmmrh
t =
u
r =
    21
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. Bpmmrhi
t =
t
r =
    20
encoded_str =
Yjpdr ejp nr;orbr om yr;rlomryovd tsodr ,u jsmf. Bpmmrhiy