我大体已经理解,但我很感兴趣您是怎么巧妙的使无论s多长使得相同结果输出同样的mode,并且怎样把八种case用一个表达式printf的呢。
“顺时针旋转90度,然后再水平翻转” 是不是就等同于 “从左到右,从下到上 打印矩阵”?
任意多个连续操作,最终都得到8个可能的结果之一。
我加了点注释,并且将 压缩s 的方式改为了查表,这样能看懂吗?

程序代码:
#include <stdio.h>
int main( void )
{
    for( unsigned r,c; scanf("%u%u",&r,&c)==2; )
    {
        unsigned char a[100*100];
        char s[100+1];
        for( unsigned i=0; i!=r*c; ++i )
            scanf( "%hhu", a+i );
        scanf( " %s", s );
        static const unsigned char transmap[8][8] =
                    { { 0, 1, 2, 3, 4, 5, 6, 7 }
                    , { 1, 2, 3, 0, 5, 6, 7, 4 }
                    , { 2, 3, 0, 1, 6, 7, 4, 5 }
                    , { 3, 0, 1, 2, 7, 4, 5, 6 }
                    , { 4, 7, 6, 5, 0, 3, 2, 1 }
                    , { 5, 4, 7, 6, 1, 0, 3, 2 }
                    , { 6, 5, 4, 7, 2, 1, 0, 3 }
                    , { 7, 6, 5, 4, 3, 2, 1, 0 } };
        unsigned mode = 0;
        for( const char* p=s; *p; ++p )
        {
            switch( *p )
            {
            case 'A': mode=transmap[mode][3]; break;
            case 'B': mode=transmap[mode][1]; break;
            case 'C': mode=transmap[mode][4]; break;
            case 'D': mode=transmap[mode][6]; break;
            }
        }
        size_t first, step1, step2, line;
         switch( mode )
        {
        case 0: first=0;     step1=1;       step2=0;           line=c; break; // 从上到下,从左到右。(逆时针旋转0度)(没有操作)
        case 1: first=c-1;   step1=c;       step2=0;           line=r; break; // 从右到左,从上到下。(逆时针旋转90度)
        case 2: first=r*c-1; step1=r*c;     step2=0;           line=c; break; // 从下到上,从右到左。(逆时针旋转180度)
        case 3: first=r*c-c; step1=r*c-c+1; step2=0;           line=r; break; // 从左到右,从下到上。(逆时针旋转270度)
        case 4: first=c-1;   step1=r*c;     step2=2*c;         line=c; break; // 从上到下,从右到左。(逆时针旋转0度,再左右颠倒)
        case 5: first=r*c-1; step1=r*c-c+1; step2=r*c-1;       line=r; break; // 从右到左,从下到上。(逆时针旋转90度,再左右颠倒)
        case 6: first=r*c-c; step1=1;       step2=2*r*c+2-2*c; line=c; break; // 从下到上,从左到右。(逆时针旋转180度,再左右颠倒)(上下颠倒)
        case 7: first=0;     step1=c;       step2=2;           line=r; break; // 从左到右,从上到下。(逆时针旋转270度,再左右颠倒)
        }
        for( size_t i=0; i!=r*c; ++i )
            printf( "%hhu%c", a[(first+i*step1+i/line*step2)%(r*c+1)], " \n"[(i+1)%line==0] );
    }
}