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++: // #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;

#define MP make_pair
#define fastIO	cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (未test)
// #define FOREACH_IT(it,c)	for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(), c_end=c.end(); it!=c_end; ++it)

// ------------------- include, typedef, define END. -------------------

vector<vector<char> > solve(vector<vector<char> > &in){
	// 90度回転
	vector<vector<char> > out(8, vector<char>(8));
	FOR(i, 0, 8){
		for (int j = 7, k = 0; j >= 0, k < 8; j--,k++){
			out[i][k] = in[j][i];
		}
	}
	return out;
}

void Output(vector<vector<char> > now, int a){
	cout << a << endl;
	FOR(i, 0, 8){
		FOR(j, 0, 8){
			cout << now[i][j];
		}
		cout << endl;
	}
}

int main(){
	fastIO;
	vector<vector<char> > in(8, vector<char>(8));

	FOR(i, 0, 8)
		FOR(j, 0, 8)
		cin >> in[i][j];

	in = solve(in);
	Output(in, 90);
	in = solve(in);
	Output(in, 180);
	in = solve(in);
	Output(in, 270);

	return 0;
}

C++: #include <iostream>
#include <stdio.h>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <math.h>
#include <iomanip>
#include <vector>
using namespace std;
#define ll long long
#define fill(a,b) memset(a,b,sizeof(a))
#define rep(i,n) for(ll i=0;i<n;++i)
#define Sort(a) sort(a.begin(),a.end())
int main(){
    char n[8][8];
    rep(i,8){
        rep(j,8){
            cin>>n[i][j];
        }
    }
    cout<<90<<endl;
    for(int i=7;i>=0;i--){
        rep(j,8){cout<<n[i][j];}
        cout<<endl;
    }
    cout<<180<<endl;
    for(int i=7;i>=0;i--){
        for(int j=7;j>=0;j--)
        {cout<<n[i][j];}
        cout<<endl;
    }
    cout<<270<<endl;
    rep(i,8){
        for(int j=7;j>=0;j--){
                cout<<n[i][j];
        }
        cout<<endl;
    }

    return 0;
}

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

char map[8][9];

void rotate(){
	char bM[8][9];
	memcpy(bM,map,72);
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			map[i][j]=bM[7-j][i];
		}
	}
}

void showmap(){
	for(int i=0;i<8;i++){
		printf("%s\n",map[i]);
	}
}
int main(void){
	for(int j=0;j<=7;j++){
		cin >> map[j];
	}
	printf("90\n");
	rotate();
	showmap();
	printf("180\n");
	rotate();
	showmap();
	printf("270\n");
	rotate();
	showmap();
    return 0;
}

C++: #include <iostream>

using namespace std;

char pattern[8][8];

void inline rotate90() {
  char o[8][8];
  for (int j = 0; j < 8; j++)
    for (int i = 0; i < 8; i++)
      o[j][i] = pattern[j][i];
  for (int j = 0; j < 8; j++)
    for (int i = 0; i < 8; i++)
      pattern[j][i] = o[7-i][j];
}

void inline print_pattern() {
  for (int j = 0; j < 8; j++) {
    for (int i = 0; i < 8; i++)
      cout << pattern[j][i];
    cout << endl;
  }
}

int main() {
  for (int j = 0; j < 8; j++)
    for (int i = 0; i < 8; i++)
      cin >> pattern[j][i];
  for (int i = 1; i <= 3; i++) {
    cout << i * 90 << endl;
    rotate90();
    print_pattern();
  }
  return 0;
}

C++: #include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
int main(void){

    string s[10];
    for(int i = 0;i < 8;i++){
        cin>>s[i];
    }

    cout<<90<<endl;
    for(int j = 0;j < 8;j++){
        for(int i = 7;i >= 0;i--){
            cout<<s[i][j];
        }
        cout<<endl;
    }
    cout<<180<<endl;
    for(int i = 7;i >= 0;i--){
        for(int j = 7;j >= 0;j--){
            cout<<s[i][j];
        }
        cout<<endl;
    }
    cout<<270<<endl;
    for(int j = 7;j >= 0;j--){
        for(int i = 0;i < 8;i++){
            cout<<s[i][j];
        }
        cout<<endl;
    }



    return 0;
}

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int h,i,j;
  char b[8][9],c[8][9],s[9];
  memset(b,0,sizeof(b));
  memset(c,0,sizeof(c));
  for(i=0;i<8;i++){
    cin>>s;
    for(j=0;j<8;j++)
      b[j][i]=s[j];
  }
  for(h=1;h<4;h++){  
    for(i=0;i<8;i++)
      for(j=0;j<8;j++)
	c[j][i]=b[i][7-j];    
    memcpy(b,c,sizeof(c));
    cout<<h*90<<endl;
    for(i=0;i<8;i++){
      for(j=0;j<8;j++)
	cout<<b[j][i];
      cout<<endl;
    }
  }
  return 0;
}

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

int main(){
  char cmap[8][8];
  for(int i=0;i<8;i++){
    for(int j=0;j<8;j++)cin >> cmap[i][j];
  }
  printf("90\n");
  for(int i=7;i>=0;i--){
    for(int j=0;j<8;j++){
      printf("%c",cmap[i][j]);
    }
    printf("\n");
  }
  printf("180\n");
  for(int i=7;i>=0;i--){
    for(int j=7;j>=0;j--){
      printf("%c",cmap[i][j]);
    }
    printf("\n");
  }
  printf("270\n");
  for(int i=0;i<=7;i++){
    for(int j=7;j>=0;j--){
      printf("%c",cmap[i][j]);
    }
    printf("\n");
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
string b[8];
int main() {
    for (int i=0; i<8; i++) cin>>b[i];
    cout<<90<<endl;
    for (int i=7; i>=0; i--) {
        for (int j=0; j<8; j++) {
            cout<<b[i][j];
        }
        cout<<endl;
    }
    cout<<180<<endl;
    for (int i=7; i>=0; i--) {
        for (int j=7; j>=0; j--) {
            cout<<b[i][j];
        }
        cout<<endl;
    }
    cout<<270<<endl;
    for (int i=0; i<8; i++) {
        for (int j=7; j>=0; j--) {
            cout<<b[i][j];
        }
        cout<<endl;
    }
}

C++: #include<iostream>
#include<string>
#define N 8
using namespace std;

void rot90(char from[N][N], char to[N][N]){
	for(int i=0;i<N;++i)for(int j=0;j<N;++j)
		to[j][N-i-1]=from[i][j];
}
int main()
{
	char pat[4][N][N];
	for(int i=0;i<N;++i){
		string s;
		cin >> s;
		for(int j = 0; j < N; ++j){
			pat[0][i][j] = s[j];
		}
	}
	rot90(pat[0],pat[1]);
	rot90(pat[1],pat[2]);
	rot90(pat[2],pat[3]);

	for(int k=1;k<=3;++k){
		cout << k*90 << '\n';
		for(int i=0;i<N;++i){
			for(int j=0;j<N;++j){
				cout << pat[k][i][j];
			}
			cout << '\n';
		}
	}
	return 0;
}