z-text
This time, Little Z is playing with his special editor. Editor is divided in n rows and m columns (n x m pixels). In editor, of course, it is possible to write word starting from any position. All words can be written only horizontal, so the lowest pixel of each letter of the word is in the same row. Each letter is 5 pixel width and 5 pixel height. Descrpition of all the letters are given below ('.' stands for painted pixel and '#' for blank pixel). All letters could be only upper-case letters from English alphabet.
Descrpition of letters from 'A' - 'Z'
##.## ...## #...# ....# ..... .....
#.#.# .##.# .###. .###. .#### .####
.###. ....# .#### .###. ...## ...##
..... .###. .###. .###. .#### .####
.###. ....# #...# ....# ..... .####
#.... .###. #...# ..... .###. .####
.#### .###. ##.## ####. .##.# .####
.#... ..... ##.## ####. ...## .####
.###. .###. ##.## .###. .##.# .####
#...# .###. #...# #...# .###. .....
.###. .###. #...# ....# #.### ....#
..#.. ..##. .###. .###. .#.## .###.
.#.#. .#.#. .###. ....# .#.## ....#
.###. .##.. .###. .#### .#.## .##.#
.###. .###. #...# .#### #.#.. .###.
#.... ..... .###. .###. .###. .###.
.#### ##.## .###. .###. .###. #.#.#
#...# ##.## .###. #.#.# .#.#. ##.##
####. ##.## .###. #.#.# .#.#. #.#.#
....# ##.## #...# ##.## #...# .###.
.###. .....
#.#.# ###.#
##.## ##.##
##.## #.###
##.## .....For pixel at row r and column [] we will say that it is pixel at the position (r, c). Letters from any word are written from left to right.
When a word should be written, everything that is on the positions where a new word should be placed will be just rewritten.
Little Z is performing two kinds of operations:
W r c wd - starting at pixel at the position (r, c) write word wd
C x1 y1 x2 y2 - count how many of the previously written words have not changed (are still readable) - even after writting the new words, some pixels might be rewritten with the same value, so that the words are not changed. It is also possible to messup the word, and then write something else so that the original word gets readable as its original again
W r c wd - (1 <= r <= n - 4), (1 <= c <= m), length of wd will be between 1 and 20, inclusive, and c + 5 * length(wd) - 1 <= m.
C r1 c1 r2 c2 - 1 <= r1 <= r2 <= n, 1 <= c1 <= c2 <= m.
[c]5 20 7
W 1 1 ACA
W 1 10 Z
C 1 1 3 9
C 1 1 4 13
C 5 20 5 20
W 1 2 A
C 3 3 3 3
Output:
1
1
0
2Explanation:
After performing first two operations, our editor looks like
##.###........######
#.#.#.######.#######
.###..#####.##.#####
......####.###.#####
.###.#.........#####After performing third W operation out editor looks like
###.##........######
##.#.#######.#######
..###.#####.##.#####
......####.###.#####
..###..........#####Note that pixel at the position (3, 3) stays same is same for the first and third word as it was at the moment of writing them.
Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.