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<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()


int main(void){
  vector<string > buf(8);
  rep(i,8){
    cin>>buf[i];
  }


  cout<<"90"<<endl;
  rep(i,8){
    rep(j,8){
      cout<<buf[7-i][j];
    }
    cout<<endl;
  }

  cout<<"180"<<endl;
  rep(i,8){
    rep(j,8){
      cout<<buf[7-i][7-j];
    }
    cout<<endl;
  }

  cout<<"270"<<endl;
  rep(i,8){
    rep(j,8){
      cout<<buf[i][7-j];
    }
    cout<<endl;
  }  
  
}

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

int main()
{
    char c[8][8];

    for( int i = 0; i < 8; i++ )
        for( int j = 0; j < 8; j++ )
            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;
    }

    return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()


int main(void){
  vector<string > buf(8);
  rep(i,8){
    cin>>buf[i];
  }


  cout<<"90"<<endl;
  rep(i,8){
    rep(j,8){
      cout<<buf[7-j][i];
    }
    cout<<endl;
  }

  cout<<"180"<<endl;
  rep(i,8){
    rep(j,8){
      cout<<buf[7-i][7-j];
    }
    cout<<endl;
  }

  cout<<"270"<<endl;
  rep(i,8){
    rep(j,8){
      cout<<buf[j][7-i];
    }
    cout<<endl;
  }  
}

C++: #include<iostream>
using namespace std;
int main()
{
  char s[8][8];
  for(int i=0;i<8;i++)
    {
      string str;
      cin>>str;
      for(int j=0;j<8;j++)
	{
	  	  
	  s[i][j]=str.at(j);
	}
      
    }
  cout<<"90"<<endl;
for(int i=0;i<8;i++)
    {
      for(int j=7;j>=0;j--)
	{
	  cout<<s[j][i];
	}
      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 i=0;i<8;i++)
    {
      for(int j=7;j>=0;j--)
	{
	  cout<<s[i][j];
	}
      cout<<endl;
    }
  return 0;
}

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

char M[4][8][8];

void rotate90AndDisp(int k) {
  for(int i=0;i<8;i++) {
    for(int j=0;j<8;j++) {
      M[k+1][i][j] = M[k][7-j][i];
      cout<<M[k+1][i][j];
    }
    cout<<endl;
  }
}

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

  for(int k=0; k<3; k++) {
    cout<<90*(k+1)<<endl;
    rotate90AndDisp(k);
  }
  
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

string MapBefore[8], MapAfter[8];

void solve() {
	char tmp[9];

	for (int j = 0; j < 8; j++) {
		for (int i = 0; i < 8; i++) {
			tmp[7-i] = MapBefore[i][j];
		}
		tmp[8] = '\0';
		MapAfter[j] = tmp;
	}
}

int main() {

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

	for (int i = 1; i < 4; i++) {
		solve();
		cout << 90 * i << endl;
		for (int i = 0; i < 8; i++) {
			cout << MapAfter[i] << endl;
		}
		for (int i = 0; i < 8; i++) {
			MapBefore[i] = MapAfter[i];
		}
	}
	
	return 0;
}

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

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[8-j-1][i];
	    t[i][j]=t2[8-j-1][i];
	  }
    }
}

C++: #include <bits/stdc++.h>
using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define sz(obj) ((int)(obj).size())
#define pf push_front
#define pb push_back

int main()
{
  char a[8][8];
  REP(i, 8){
    REP(j, 8) cin >> a[i][j];
  }
  cout << 90 << endl;
  RREP(i, 8){
    REP(j, 8) cout << a[i][j];
    cout << endl;
  }
  cout << 180 << endl;
  RREP(i, 8){
    RREP(j, 8) cout << a[i][j];
    cout << endl;
  }
  cout << 270 << endl;
  REP(i, 8){
    RREP(j, 8) cout << a[i][j];
    cout << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	vector<string> v(8);
	rep(i,8){
		cin>>v[i];
	}
	cout<<90<<endl;
	rep(i,8){
		rep(j,8){
			cout<<v[7-i][j];
		}
		cout<<endl;
	}
	cout<<180<<endl;
	rep(i,8){
		rep(j,8){
			cout<<v[7-i][7-j];
		}
		cout<<endl;
	}
	cout<<270<<endl;
	rep(i,8){
		rep(j,8){
			cout<<v[i][7-j];
		}
		cout<<endl;
	}
}

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

int main(){
  char p[8][9];
  char p90[8][9],p180[8][9],p270[8][9];
  int i,j;

  for(i=0;i<8;i++)scanf("%s",p[i]);

  for(i=0;i<8;i++){
    for(j=0;j<8;j++){
      p90[i][j] = p[7-j][i];
      p180[i][j] = p[7-i][7-j];
      p270[i][j] = p[j][7-i];
    }
  }
  for(i=0;i<8;i++){
    p90[i][8] = '\0';
    p180[i][8] = '\0';
    p270[i][8] = '\0';
  }
  cout << "90" << endl;
  for(i=0;i<8;i++)printf("%s\n",p90[i]);
  cout << "180" << endl;
  for(i=0;i<8;i++)printf("%s\n",p180[i]);
  cout << "270" << endl;
  for(i=0;i<8;i++)printf("%s\n",p270[i]);

  return 0;
}