The Background
Imagine the English alphabet written out in a row in capital letters -- ABCDEFGHIJKLMNOPQRSTUVWXYZ
. Suppose we have a special variable-width lens such that, when placed over the row, it shows a certain "window" of the alphabet, with letters outside the lens hidden from view. Additionally, this lens has a warping characteristic, so that the first letter inside the lens, and every second letter thereafter, is lower-cased, but the remaining letters still show capitalized.
For example, we could have a lens of length 5 placed somewhere in the middle of the alphabet and we would only see . jKlMn
(leading period here to ensure whitespace shows) -- note the K
and M
are still capitalized, while the j
, l
, and n
are all lower-cased. As we slide this lens from left-to-right along the alphabet, different letters would be shown and different letters capitalized. The task here is to output the resultant letters as the lens slides along the alphabet.
The Challenge
Write a program or function that takes an input integer 0 < n < 27
and outputs or returns the string(s) that are visible as the lens described above slides across the alphabet.
For values of n
larger than 1
, the lens begins by "hanging" off the left side of the alphabet, so only the A
is shown in the right-most slot of the lens. The first line of any output will thus be a single A
, either capital or lowercase depending upon the length of the lens.
Similarly, the lens finishes sliding when the Z
is in the left-most slot of the lens (meaning that the very last line in any output will always be 25 spaces followed by a lowercase z
).
The Examples
Input: 1
Output:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Input: 4
Output:
A
aB
AbC
aBcD
bCdE
cDeF
dEfG
eFgH
fGhI
gHiJ
hIjK
iJkL
jKlM
kLmN
lMnO
mNoP
nOpQ
oPqR
pQrS
qRsT
rStU
sTuV
tUvW
uVwX
vWxY
wXyZ
xYz
yZ
z
Input: 26
Output:
A
aB
AbC
aBcD
AbCdE
aBcDeF
AbCdEfG
aBcDeFgH
AbCdEfGhI
aBcDeFgHiJ
AbCdEfGhIjK
aBcDeFgHiJkL
AbCdEfGhIjKlM
aBcDeFgHiJkLmN
AbCdEfGhIjKlMnO
aBcDeFgHiJkLmNoP
AbCdEfGhIjKlMnOpQ
aBcDeFgHiJkLmNoPqR
AbCdEfGhIjKlMnOpQrS
aBcDeFgHiJkLmNoPqRsT
AbCdEfGhIjKlMnOpQrStU
aBcDeFgHiJkLmNoPqRsTuV
AbCdEfGhIjKlMnOpQrStUvW
aBcDeFgHiJkLmNoPqRsTuVwX
AbCdEfGhIjKlMnOpQrStUvWxY
aBcDeFgHiJkLmNoPqRsTuVwXyZ
bCdEfGhIjKlMnOpQrStUvWxYz
cDeFgHiJkLmNoPqRsTuVwXyZ
dEfGhIjKlMnOpQrStUvWxYz
eFgHiJkLmNoPqRsTuVwXyZ
fGhIjKlMnOpQrStUvWxYz
gHiJkLmNoPqRsTuVwXyZ
hIjKlMnOpQrStUvWxYz
iJkLmNoPqRsTuVwXyZ
jKlMnOpQrStUvWxYz
kLmNoPqRsTuVwXyZ
lMnOpQrStUvWxYz
mNoPqRsTuVwXyZ
nOpQrStUvWxYz
oPqRsTuVwXyZ
pQrStUvWxYz
qRsTuVwXyZ
rStUvWxYz
sTuVwXyZ
tUvWxYz
uVwXyZ
vWxYz
wXyZ
xYz
yZ
z
The Rules
- Standard input/output rules apply
- Standard loopholes disallowed
- Standard code-golf rules apply
- The leading whitespace as shown is required, so that we know where we're at in the alphabet.
- Each line cannot have trailing whitespace (as shown - the output is not a rectangle).
- A single trailing newline is optional.