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 <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
using namespace std;

#define rep(i,n) for(int (i)=0; (i)<(int)(n); ++(i))
#define foreach(c,i) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)

char c[8][10];

void rotate() {
  char _c[8][10];
  rep (i,8) fill(_c[i], _c[i] + 10, ' ');
  
  rep (i,8) rep (j,8) {
    double x = j - 3.5, y = i - 3.5;
    double tx = -y + 3.5, ty = x + 3.5;
    _c[(int)ty][(int)tx] = c[i][j];
  }
  
  rep (i,8) rep (j,8) c[i][j] = _c[i][j];
}

int main() {
  rep (i,8) scanf("%s", c[i]);
  const int l[3] = { 90, 180, 270 };
  rep (i,3) {
    printf("%d\n", l[i]);
    rotate();
    rep (j,8) puts(c[j]);
  }
  return 0;
}

C++: #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){

	char table[8][9];

	for(int i=0; i < 8; i++){
		scanf("%s",table[i]);
	}

	printf("90\n");

	for(int i = 0; i <= 7; i++){
		for(int k=7; k>= 0; k--){
			printf("%c",table[k][i]);
		}
		printf("\n");
	}

	printf("180\n");

	for(int i=7; i >=0; i--){
		for(int k=7; k>=0;k--){
			printf("%c",table[i][k]);
		}
		printf("\n");
	}

	printf("270\n");

	for(int i=7; i >= 0; i--){
		for(int k=0; k <= 7; k++){
			printf("%c",table[k][i]);
		}
		printf("\n");
	}


    return 0;
}

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

int main() {
    vector<string> d(8);
    for (auto& i : d) cin >> i;

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

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

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

    return 0;
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip> 
#include <complex> 
#include <string>
#include <vector> 
#include <list>
#include <deque> 
#include <stack> 
#include <queue> 
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm> 
#include <numeric> 
#include <typeinfo> 
#include <cstdio>
#include <cstdlib> 
#include <cstring>
#include <cmath>
#include <climits> 
#include <ctime>
using namespace std;

char str[9][9];
char str2[9][9];
void change(){
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			str2[i][j]=str[7-j][i];
		}
	}
	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			str[i][j]=str2[i][j];
		}
	}
}

int main(void){
	for(int i=0;i<8;i++){
		cin >> str[i];
	}
	cout << "90" << endl;
	change();
	for(int i=0;i<8;i++){
		cout << str[i] << endl;
	}
	cout << "180" << endl;
	change();
	for(int i=0;i<8;i++){
		cout << str[i] << endl;
	}
	cout << "270" << endl;
	change();
	for(int i=0;i<8;i++){
		cout << str[i] << endl;
	}
    return 0;
}

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];
    cout << "90" << endl;
    for(int i=0; i<8; i++){
        for(int j=0; j<8; j++) cout << pattern[7-j][i];
        cout << endl;
    }
    cout << "180" << endl;
    for(int i=0; i<8; i++){
        for(int j=0; j<8; j++) cout << pattern[7-i][7-j];
        cout << endl;
    }
    cout << "270" << endl;
    for(int i=0; i<8; i++){
        for(int j=0; j<8; j++) cout << pattern[j][7-i];
        cout << endl;
    }
    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=0 ; i < 8 ; i++){
    for(int j=7 ; j >= 0 ; j--){
      cout <<str[j][i];
    }
    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=7 ; i >= 0 ; i--){
    for(int j=0 ; j < 8 ; j++){
      cout <<str[j][i];
    }
    cout <<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define rep(i,n) for(int i=0; i<(n); i++)
#define repc(i,s,e) for(int i=(s); i<(e); i++)
#define pb(n) push_back((n))
#define mp(n,m) make_pair((n),(m))
#define all(r) r.begin(),r.end()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<ll> vl;
typedef vector<vl> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;






int main() {
	string s[8];
	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 j = 0; j < 8; j++) {
		for (int i = 0; i < 8; i++) {
			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;
	}
}

C++: #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N 200000






int main(){
	char a[10][10];
	f(i, 8){
		scanf("%s", a[i]);
	}
	printf("90\n");
	f(i, 8){
		f(j, 8){
			printf("%c", a[7-j][i]);
		}
		printf("\n");
	}
	printf("180\n");
	f(i, 8){
		f(j, 8){
			printf("%c", a[7 - i][7 - j]);
		}
		printf("\n");
	}
	printf("270\n");
	f(i, 8){
		f(j, 8){
			printf("%c", a[j][7 - i]);
		}
		printf("\n");
	}




	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAX = 8;

string s[MAX];

int main()
{
    REP(MAX) cin >> s[i];

    cout << "90"<< endl;
    rep(j,MAX){rep(i,MAX) cout << s[MAX-i-1][j]; cout << endl;}

    cout << "180" << endl;
    rep(i,MAX){rep(j,MAX) cout << s[MAX-i-1][MAX-j-1]; cout << endl;}

    cout << "270" << endl;
    rep(j,MAX){rep(i,MAX) cout << s[i][MAX-j-1]; cout << endl;}

    return 0;
}

C++: #include<stdio.h>
#include<string.h>
int main(){
	char m[9][9],s[9][9];
	int i,j,k=0;
	for(j=0;j<8;j++){
		scanf("%s",m[j]);
		strcpy(s[j],m[j]);
	}
	for(k=90;k<360;k+=90){
		printf("%d\n",k);
		for(i=0;i<8;i++){
			for(j=0;j<8;j++){
				s[j][7-i]=m[i][j];
			}
		}
		for(j=0;j<8;j++){
			printf("%s\n",s[j]);
			strcpy(m[j],s[j]);
		}
	}
    return 0;
}