#include <bits/stdc++.h>   using namespace std;   const int shape[4][4][2] = {{{1, 0}, {2, 0}, {1, 1}, {1, 2}},                               {{1, 0}, {2, 0}, {2, -1}, {2, 1}},                               {{0, 1}, {0, 2}, {-1, 2}, {1, 2}},                               {{0, 1}, {0, 2}, {1, 1}, {2, 1}}};   int x, y;   struct node {     char g[9][9];     int num;     int sx, sy;     int layer;     node() {       layer = 0;       sx = sy = 0;       memset(g, 0, sizeof(g));       num = 0;     }     void printNode() {       for (int i = 0; i < y; i++) {         for (int j = 0; j < x; j++) printf( %c , g[i][j] ? g[i][j] :  . );         cout <<    << endl;       }     }   };   stack<node> q;   int ans;   node ansNode;   int maxG[9][9][4];   void bfs() {     while (!q.empty()) {       node now = q.top();       q.pop();       if (now.num > ans) {         ans = now.num;         ansNode = now;       }       now.num++;       char ch =  A  + now.num - 1;       for (int i = now.sy; i < y; i++) {         for (int j = 0; j < x; j++) {           if (!now.g[i][j]) {             for (int k = 0; k < 4; k++) {               if (maxG[i][j][k] > now.num + 1) continue;               bool flag = true;               for (int l = 0; l < 4 && flag; l++) {                 int tx = j + shape[k][l][1];                 int ty = i + shape[k][l][0];                 if (tx < 0 || tx >= x || ty < 0 || ty >= y || now.g[ty][tx]) {                   flag = false;                 }               }               if (flag) {                 node tNode = now;                 tNode.g[i][j] = ch;                 for (int l = 0; l < 4; l++) {                   int tx = j + shape[k][l][1];                   int ty = i + shape[k][l][0];                   tNode.g[ty][tx] = ch;                 }                 tNode.sx = j + 1;                 tNode.sy = i;                 tNode.layer++;                 q.push(tNode);                 maxG[i][j][k] = max(maxG[i][j][k], now.num);               }             }           }         }       }     }   }   int main() {     ans = -1;     cin >> y >> x;     while (!q.empty()) q.pop();     q.push(node());     bfs();     cout << ans << endl;     ansNode.printNode();     return 0;   }   