forked from edinfazlic/CodinGame-Solutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ASCIIArt.java
32 lines (27 loc) · 902 Bytes
/
ASCIIArt.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.Scanner;
class Solution {
public static final int INPUT_CHARACTERS = 27;
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int L = in.nextInt();
in.nextLine();
int H = in.nextInt();
in.nextLine();
String T = in.nextLine();
String ROWS = "";
for (int i = 0; i < H; i++) {
ROWS += in.nextLine();
}
T = T.toUpperCase();
StringBuilder res = new StringBuilder();
for (int row = 0; row < H; row++) {
for (char ch : T.toCharArray()) {
int position = ch < 65 || ch > 90 ? 26 : ch - 65;
int start = (L * INPUT_CHARACTERS) * row + position * L;
res.append(ROWS.substring(start, start + L));
}
res.append("\n");
}
System.out.println(res);
}
}