-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathASCII Art.cpp
More file actions
39 lines (33 loc) · 786 Bytes
/
ASCII Art.cpp
File metadata and controls
39 lines (33 loc) · 786 Bytes
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
33
34
35
36
37
38
39
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int l;
cin >> l; cin.ignore();
int h;
cin >> h; cin.ignore();
string t;
getline(cin, t);
transform(t.begin(), t.end(), t.begin(), ::toupper);
vector<string> rows(h);
for (int i = 0; i < h; i++) {
getline(cin, rows[i]);
}
for (int i = 0; i < h; i++) {
string line;
for (char c : t) {
int index;
if (c >= 'A' && c <= 'Z') {
index = c - 'A';
}
else {
index = 26; // '?'
}
line += rows[i].substr(index * l, l);
}
cout << line << endl;
}
}