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 _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	vector<string>v;
	rep(i, 0, 8) {
		string s; cin >> s; v.push_back(s);
	}

	cout << 90 << endl;
	rep(j, 0, 8) {
		rrep(i, 0, 8) {
			cout << v[i][j];
		}
		cout << endl;
	}

	cout << 180 << endl;
	rrep(i, 0, 8) {
		rrep(j, 0, 8) {
			cout << v[i][j];
		}
		cout << endl;
	}

	cout << 270 << endl;
	rrep(j, 0, 8) {
		rep(i, 0, 8) {
			cout << v[i][j];
		}
		cout << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<cstring>

char ptn[8][8];

void rotate()
{
	char tmp[8][8];
	memcpy( tmp, ptn, sizeof( ptn ) );

	for( int i = 0; i != 8; ++i )
		for( int j = 0; j != 8; ++j )
			ptn[i][j] = tmp[7-j][i];
	
	return;
}

int main()
{
	for( int i = 0; i != 8; ++i )
		for( int j = 0; j != 8; ++j )
			std::cin >> ptn[i][j];

	for( int i = 1; i <= 3; ++i )
	{
		rotate();
		std::cout << i * 90 << std::endl;

		for( int j = 0; j != 8; ++j )
		{
			for( int k = 0; k != 8; ++k )
				std::cout << ptn[j][k];

			std::cout << std::endl;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<cstring>
using namespace std;
int main()
{
  char t[8][8],t2[8][8];
  for(int i=0;i<8;i++)
    for(int j=0;j<8;j++)
      cin>>t[i][j];

  for(int x=1;x<4;x++)
    {
      cout<<90*x<<endl;
      memcpy(t2,t,sizeof(t));
      for(int i=0;i<8;i++,cout<<endl)
	for(int j=0;j<8;j++)
	  {
	    cout<<t2[j][8-i-1];
	    t[i][j]=t2[j][8-i-1];
	  }
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rrep(i,n) for(int i=(int)(n)-1; i>=0; i--)
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin(); it!=(c).end(); it++)
#define pb(a) push_back(a)
#define pr(a) cout << (a) << endl
#define PR(a,b) cout << (a) << " " << (b) << endl
#define F first
#define S second
typedef long long ll;
typedef pair<int,int> P;
const int MAX=1000000001;
const ll MAXL=1000000000000000001LL;
const ll mod=1000000007;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int main() {
  int a=0;
  string s[8];
  rep(i,8) {
    string t;
    cin >> t;
    s[i]=t;
  }
  rep(k,3) {
    a+=90;
    pr(a);
    string s2[8]=s;
    rep(i,8) {
      rep(j,8) {
	s2[i][j]=s[7-j][i];
      }
      pr(s2[i]);
    }
    rep(i,8) s[i]=s2[i];
  }
  return 0;
}

C++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
int main(){
	
	string s[8];
	vector<string> t(8,"        ");
	for(int i=0;i<8;i++){
		cin>>s[i];
	}
	
	for(int i=1;i<=3;i++){
		cout<<90*i<<endl;
		for(int j=0;j<8;j++){
			for(int k=0;k<8;k++){
				t[k][j]=s[7-j][k];
			}
		}
		for(int j=0;j<8;j++){
			cout<<t[j]<<endl;
			s[j]=t[j];
		}
	}
	
	
	
}

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

int main()
{
  char pattern[8][8];
  for (int i=0; i<8; i++)
  {
    for (int j=0; j<8; j++)
    {
      cin >> pattern[i][j];
    }
  }

  char pattern2[8][8];
  for (int n=1; n<=3; n++)
  {
    for (int i=0; i<8; i++)   //回転
    {
      for (int j=0; j<8; j++)
      {
        pattern2[j][7-i] = pattern[i][j];
      }
    }


    cout << n*90 << endl;
    for (int i=0; i<8; i++)   //表示 
    {
      for (int j=0; j<8; j++)
      {
        cout << pattern2[i][j] << flush;
      }
      cout << endl;
    }
    for (int i=0; i<8; i++)   //代入
    {
      for (int j=0; j<8; j++)
      {
        pattern[i][j] = pattern2[i][j];
      }
    }

  }
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
char f[9][9];
int main()
{
	for(int i=0;i<8;i++)
	{
		for(int j=0;j<8;j++)
		{
			cin >> f[i][j];
		}
	}
	cout << 90 << endl;
	for(int j=0;j<8;j++)
	{
		for(int i=7;i>=0;i--)
		{
			cout << f[i][j];
		}
		cout << endl;
	}
	cout << 180 << endl;
	for(int i=7;i>=0;i--)
	{
		for(int j=7;j>=0;j--)
		{
			cout << f[i][j];
		}
		cout << endl;
	}
	cout << 270 << endl;
	for(int j=7;j>=0;j--)
	{
		for(int i=0;i<8;i++)
		{
			cout << f[i][j];
		}
		cout << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <vector>

using namespace std;

char p[8][8];

int main()
{
    for(int i = 0; i < 8; i++) 
        for(int j = 0; j < 8; j++ )
            cin >> p[i][j];

    for(int i = 0; i < 3; ++i) {
        cout << 90 * (i + 1) << endl;
        for(int j = 0; j < 8; j++) {
            for(int k = 0; k < 8; k++) {
                char c;
                if(i == 0) {
                    c = p[j][7-k];

                } else if(i == 1) {
                    c = p[7-k][7-j];
                } else {
                    c = p[7-j][k];

                }
                cout << c;
            }
            cout << endl;
        }
    }
}

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=0; i<8; i++) {
        for (int j=7; j>=0; j--) {
            cout<<b[j][i];
        }
        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=7; i>=0; i--) {
        for (int j=0; j<8; j++) {
            cout<<b[j][i];
        }
        cout<<endl;
    }
}

C++: #include <iostream>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <string>
#include <cmath>
#include <map>
#include <vector>
#include <sstream>

#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;
typedef long long ll;


void kai(string z[], int hk){
	string w[8];
	fill(w,w+8,"        ");
	if(hk==1)
		rep(i,8) rep(j,8) w[j][7-i]=z[i][j];
	else if(hk==2)
		rep(i,8) rep(j,8) w[7-i][7-j]=z[i][j];
	else
		rep(i,8) rep(j,8) w[7-j][i]=z[i][j];
	rep(i,8) cout << w[i] << endl;
}

int main() {
	string ba[8];
	
	rep(i,8) cin >> ba[i];
	cout << "90" << endl;
	kai(ba,1);
	cout << "180" << endl;
	kai(ba,2);
	cout << "270" << endl;
	kai(ba,3);
	
	return 0;
}