Go: package main

import (
	"bufio"
	"os"
	"fmt"
	"strings"
	)

var scanner = bufio.NewScanner(os.Stdin)
var title = [4]int{0, 90, 180, 270}

func main() {
	p := make([][]string, 8)
	for i := range p {
		scanner.Scan()
		p[i] = strings.Split(scanner.Text(), "")
	}
	// log.Println(p)
	for i := 1; i < 4; i++ {
		fmt.Println(title[i])
		p = spin(p)
		print_p(p)
	}
}

func spin(p [][]string) [][]string {
	ret := make([][]string, 8)
	for i := range ret {
		ret[i] = make([]string, 8)
	}
	for i := 0; i < 8; i++ {
		for j := 0; j < 8; j++ {
			ret[i][j] = p[7-j][i]
		}
	}
	return ret
}

func print_p(p [][]string) {
	for _, v := range p {
		fmt.Println(strings.Join(v, ""))
	}
}

C++: #include<iostream>
using namespace std;

char pt[8][8];

void put90(){
	for(int i=0; i<8; i++){
		for(int j=7; j>=0; j--)
			cout << pt[j][i];
		cout << endl;
	}
}

void put180(){
	for(int i=7; i>=0; i--){
		for(int j=7; j>=0; j--)
			cout << pt[i][j];
		cout << endl;
	}
}

void put270(){
	for(int i=7; i>=0; i--){
		for(int j=0; j<8; j++)
			cout << pt[j][i];
		cout << endl;
	}
}

int main(){
	for(int i=0; i<8; i++)
		for(int j=0; j<8; j++)
			cin >> pt[i][j];
	cout << 90 << endl;
	put90();
	cout << 180 << endl;
	put180();
	cout << 270 << endl;
	put270();
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

char c[8][8];

int main(){
	REP(i, 8){
		REP(j, 8){
			cin >> c[i][j];
		}
	}
	cout << "90" << endl;
	for (int j = 0; j < 8; j++){
		for (int i = 7; i >= 0; i--){
			cout << c[i][j];
		}
		cout << endl;
	}
	cout << "180" << endl;
	for (int i = 7; i >= 0; i--){
		for (int j = 7; j >= 0; j--){
			cout << c[i][j];
		}
		cout << endl;
	}
	cout << "270" << endl;
	for (int j = 7; j >= 0; j--){
		for (int i = 0; i <= 8; i++){
			cout << c[i][j];
		}
		cout << endl;
	}
}

C++: #include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#ifdef Debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#else
#define dump(x)
#endif

char data[8][8];

void rot(){
	char tmp[8][8];
	for(int j=0;j<8;j++){
		for(int i=7;i>=0;i--){
			tmp[j][i]=data[7-i][j];
		}
	}

	rep(i,8)rep(j,8)data[i][j]=tmp[i][j];
}

int main(){
	rep(i,8)rep(j,8)cin>>data[i][j];

	rep(i,3){
		cout<<(i+1)*90<<endl;
		rot();

		rep(j,8){
			rep(k,8)cout<<data[j][k];
			cout<<endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using namespace std;

int main(void){
	char map[12][12];
	for(int j=0;j<=7;j++){
		scanf("%s",map[j]);
	}
	printf("90\n");
	for(int i=7;i>=0;i--){
		for(int j=0;j<=7;j++){
			printf("%c",map[i][j]);
		}
		printf("\n");
	}
	printf("180\n");
	for(int i=7;i>=0;i--){
		for(int j=7;j>=0;j--){
			printf("%c",map[i][j]);
		}
		printf("\n");
	}
	printf("270\n");
	for(int i=0;i<=7;i++){
		for(int j=7;j>=0;j--){
			printf("%c",map[i][j]);
		}
		printf("\n");
	}
    return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>

using namespace std;

typedef long long ll;
typedef pair<char,int> P;

static const double eps = 10e-9;

void rotate90(char input[8][8], char output[8][8])
{
	for(int y=0;y<8;y++){
		for(int x=0;x<8;x++){
			double dx = x*cos(M_PI/2.0) - y*sin(M_PI/2.0) + 7;
			double dy = x*sin(M_PI/2.0) + y*cos(M_PI/2.0);

			output[(int)(dy+eps)][(int)(dx+eps)]=input[y][x];
		}
	}
}

void rotate180(char input[8][8], char output[8][8])
{
	for(int y=0;y<8;y++){
		for(int x=0;x<8;x++){
			double dx = x*cos(M_PI) - y*sin(M_PI) + 7;
			double dy = x*sin(M_PI) + y*cos(M_PI) + 7;
			output[(int)(dy+eps)][(int)(dx+eps)]=input[y][x];
		}
	}
}

void rotate270(char input[8][8], char output[8][8])
{
	for(int y=0;y<8;y++){
		for(int x=0;x<8;x++){
			double dx = x*cos(3.0*M_PI/2.0) - y*sin(3.0*M_PI/2.0);
			double dy = x*sin(3.0*M_PI/2.0) + y*cos(3.0*M_PI/2.0) + 7;

			output[(int)(dy+eps)][(int)(dx+eps)]=input[y][x];
		}
	}
}

void printStage(char stage[8][8])
{
	for(int y=0;y<8;y++){
		for(int x=0;x<8;x++){
			printf("%c%s",stage[y][x],x==7 ? "\n" : "");
		}
	}
}




int main(){

	double eps = 10e-9;
	char stage[8][8];
	for(int y=0;y<8;y++){
		string str;
		getline(cin,str);
		for(int x=0;x<8;x++){
			stage[y][x] = str[x];
		}
	}

	char res[8][8];
	rotate90(stage,res);
	cout << 90 << endl;
	printStage(res);

	rotate180(stage,res);
	cout << 180 << endl;
	printStage(res);

	rotate270(stage,res);
	cout << 270 << endl;
	printStage(res);
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<string> table(8);
    for(int i = 0; i < 8; i++) cin >> table[i];
    cout << 90 << endl;
    for(int j = 0; j < 8; j++)
    {
        for(int i = 7; i >= 0; i--) cout << table[i][j]; cout << endl;
    }
    cout << 180 << endl;
    for(int i = 7; i >= 0; i--)
    {
        for(int j = 7; j >= 0; j--) cout << table[i][j]; cout << endl;
    }
    cout << 270 << endl;
    for(int j = 7; j >= 0; j--)
    {
        for(int i = 0; i < 8; i++) cout << table[i][j]; cout << endl;
    }
    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <stdio.h>
#include <ctype.h>
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <fstream>
#include <sstream>
#include <queue>
#include <exception>
#include <cmath>
#include <numeric>
#include <map>
#include <algorithm>
#include <bitset>
#include <set>
#include <functional>

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

using namespace std;
typedef long long int lint;
typedef vector<vector<char> > matrix;

void print(matrix& mat) {
	REP(y, mat.size()) {
		REP(x, mat[0].size()) {
			cout << mat[y][x];
		}
		cout << endl;
	}
}

matrix mk_matrix(int n, int m) {
	matrix mat(n);
	REP(i, n) {
		mat[i] = vector<char>(m, 0);
	}
	return mat;
}

void rotate90(matrix& src) {
	matrix dst = mk_matrix(8, 8);
	REP(y, 8) {
		REP(x, 8) {
			dst[x][8 - y - 1] = src[y][x];
		}
	}
	src = dst;
}

bool AOJ0133()
{
	matrix mat = mk_matrix(8, 8);
	REP(i, 8) {
		REP(j, 8) {
			cin >> mat[i][j];
		}
	}
	cout << "90" << endl;
	rotate90(mat);
	print(mat);
	cout << "180" << endl;
	rotate90(mat);
	print(mat);
	cout << "270" << endl;
	rotate90(mat);
	print(mat);

	return true;
}

int main()
{
	AOJ0133();

	return 0;
}