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>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P) 
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



string fi[10];

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

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

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

C++: #include <iostream>
#include <string>
using namespace std;
int main() {
  char data[8][8];
  for(int i = 0; i < 8; i++) {
    for(int j = 0; j < 8; j++) {
      cin >> data[i][j];
    }
  }

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


  return 0;
}

C++: #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
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;
}

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

int main(void){
	char map[12][12];
	memset(map,'\0',sizeof(map));
	for(int j=0;j<=7;j++){
		cin >> 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++: #include<bits/stdc++.h>
using namespace std;

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

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

int x[8][8];
int y[8][8];
char c;

void TheRotate90() {
	for (int j = 0; j < 8; j++) {
		for (int k = 0; k < 8; k++) {
			y[k][7 - j] = x[j][k];
		}
	}
}

int main() {
	for (int i = 0; i < 8; i++) {
		for (int j = 0; j < 8; j++) {
			cin >> c;
			if (c == '#') { x[i][j] = 1; }
			else { x[i][j] = 0; }
		}
	}
	for (int i = 90; i <= 270; i += 90) {
		cout << i << endl;
		TheRotate90();
		for (int j = 0; j < 8; j++) {
			for (int k = 0; k < 8; k++) {
				x[j][k] = y[j][k];
				if (x[j][k] == 0) { cout << '*'; }
				else { cout << '#'; }
			}
			cout << endl;
		}
	}
	return 0;
}

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

int func1( int n )
{
	return n;
}

int func2( int n )
{
	return 7 - n;
}

void output( char map[][ 8 ], int dir )
{
	int angle = dir * 90;
	int i, j;
	int *p1, *p2;
	int (*f1)(int), (*f2)(int);
	switch( dir ){
		case 1: f1 = &func2; f2 = &func1; p1 = &j; p2 = &i; break;
		case 2: f1 = &func2; f2 = &func2; p1 = &i; p2 = &j; break;
		case 3: f1 = &func1; f2 = &func2; p1 = &j; p2 = &i; break;

	}

	cout << angle << endl;
	for( i = 0; i < 8; ++i ){
		for( j = 0; j < 8; ++j ){
			cout << map[ f1( i ) ][ f2( j ) ];
		}
		cout << endl;
	}
}

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

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

	output( map, 1 );
	output( map, 2 );
	output( map, 3 );

	return 0;
}

C++: #include<bits/stdc++.h>
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 i=0;i<8;i++){
			for(int j=7;j>-1;j--){
				cout<<c[j][i];
				if(j==0){cout<<endl;}
				}
			}
			
		cout<<"180"<<endl;
		for(int i=7;i>-1;i--){
			for(int j=7;j>-1;j--){
				cout<<c[i][j];
				if(j==0)cout<<endl;
				}
			}
			
		cout<<"270"<<endl;
		for(int i=7;i>-1;i--){
			for(int j=0;j<8;j++){
				cout<<c[j][i];
				if(j==7)cout<<endl;
				}
			}		
		return 0;	
			
	}