Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block Letter Printer #67

Open
margo-yunanova opened this issue Sep 25, 2023 · 0 comments
Open

Block Letter Printer #67

margo-yunanova opened this issue Sep 25, 2023 · 0 comments
Assignees
Milestone

Comments

@margo-yunanova
Copy link
Owner

margo-yunanova commented Sep 25, 2023

Write a function that accepts a string consisting only of ASCII letters and space(s) and returns that string in block letters of 5 characters width and 7 characters height, with one space between characters.

The string should be formatted in a way that when passed to Javascripts' console.log() function shows the desired output (see below for example).

There's a preloaded map called alpha which you can use. Keys are lower case letters and the space.

  1. The block letters should consist of corresponding capital letters.
  2. It's irrelevant whether input consists of lower or upper case letters.
  3. Any leading and/or trailing spaces in input should be ignored.
  4. Empty strings or such containing only spaces should return an empty string.
  5. The remaining spaces (between letters and/or words) are to be treated as any other character. This means that there will be six spaces in output for a space in input, or a multiple of six, if there were more spaces - plus the one from preceding character!
  6. Trailing spaces should be removed in the resulting string.
    console.log(blockPrint("heLLo WorLD"));

should result in an output that looks like this:

H   H EEEEE L     L      OOO        W   W  OOO  RRRR  L     DDDD
H   H E     L     L     O   O       W   W O   O R   R L     D   D
H   H E     L     L     O   O       W   W O   O R   R L     D   D
HHHHH EEEEE L     L     O   O       W W W O   O RRRR  L     D   D
H   H E     L     L     O   O       W W W O   O R R   L     D   D
H   H E     L     L     O   O       W W W O   O R  R  L     D   D
H   H EEEEE LLLLL LLLLL  OOO         W W   OOO  R   R LLLLL DDDD

As most of the characters can be printed in many different ways (think of Q, F or W), here is what they're expected to look like:

AAA  BBBB   CCC  DDDD  EEEEE FFFFF  GGG  H   H IIIII JJJJJ K   K L     M   M N   N  OOO  PPPP   QQQ  RRRR   SSS  TTTTT U   U V   V W   W X   X Y   Y ZZZZZ
A   A B   B C   C D   D E     F     G   G H   H   I       J K  K  L     MM MM NN  N O   O P   P Q   Q R   R S   S   T   U   U V   V W   W X   X Y   Y     Z
A   A B   B C     D   D E     F     G     H   H   I       J K K   L     M M M N   N O   O P   P Q   Q R   R S       T   U   U V   V W   W  X X   Y Y     Z
AAAAA BBBB  C     D   D EEEEE FFFFF G GGG HHHHH   I       J KK    L     M   M N N N O   O PPPP  Q   Q RRRR   SSS    T   U   U V   V W W W   X     Y     Z
A   A B   B C     D   D E     F     G   G H   H   I       J K K   L     M   M N   N O   O P     Q Q Q R R       S   T   U   U V   V W W W  X X    Y    Z
A   A B   B C   C D   D E     F     G   G H   H   I       J K  K  L     M   M N  NN O   O P     Q  QQ R  R  S   S   T   U   U  V V  W W W X   X   Y   Z
A   A BBBB   CCC  DDDD  EEEEE F      GGG  H   H IIIII JJJJ  K   K LLLLL M   M N   N  OOO  P      QQQQ R   R  SSS    T    UUU    V    W W  X   X   Y   ZZZZZ

https://www.codewars.com/kata/6375587af84854823ccd0e90/train/javascript

@margo-yunanova margo-yunanova added this to the Codewars milestone Sep 25, 2023
@margo-yunanova margo-yunanova self-assigned this Sep 25, 2023
@margo-yunanova margo-yunanova changed the title задача Block Letter Printer Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant