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>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	char ch[8][8],hoge[8][8];
	rep(i,8)rep(j,8)cin>>ch[i][j];
	rep(p,3){
		if(p==0)cout<<"90"<<endl;
		if(p==1)cout<<"180"<<endl;
		if(p==2)cout<<"270"<<endl;
		rep(i,8)rep(j,8)hoge[i][j]=ch[8-j-1][i];
		rep(i,8){
			rep(j,8){cout<<hoge[i][j];ch[i][j]=hoge[i][j];}
			cout<<endl;
		}
	}
	return 0;
}

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

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

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

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

  return 0;
}

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

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

	cout << 90 << endl;

	for(int y = 0; y < 8; y++) {
		for(int x = 0; x < 8; x++) {
			char c = s[7 - x][y];
			cout << c;
		}
		cout << endl;
	}

	cout << 180 << endl;

	for(int y = 0; y < 8; y++) {
		for(int x = 0; x < 8; x++) {
			char c = s[7 - y][7 - x];
			cout << c;
		}
		cout << endl;
	}

	cout << 270 << endl;

	for(int y = 0; y < 8; y++) {
		for(int x = 0; x < 8; x++) {
			char c = s[x][7 - y];
			cout << c;
		}
		cout << endl;
	}
}

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

#define f first
#define s second
#define mp make_pair

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

using namespace std;

typedef unsigned int uint;
typedef long long ll;
typedef complex<double> P;

int main(){
  char buff[8][10];
  REP(i,8) fgets(buff[i],sizeof(buff[i]),stdin);
  REP(k,3){
    char ans[8][10] = {{0}};
    REP(i,8) REP(j,8)
      ans[i][j] = buff[7-j][i];
    printf("%d\n",(k+1)*90);
    REP(i,8) puts(ans[i]);

    REP(i,8) REP(j,10) buff[i][j] = ans[i][j];
  }
  return 0;
}

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

char x[10][10];
char y[10][10];

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 >> x[i][j];
		}
	}
	for (int i = 1; i < 4; i++) {
		cout << i * 90 << endl;
		TheRotate90();
		for (int j = 0; j < 8; j++) {
			for (int k = 0; k < 8; k++) {
				x[j][k] = y[j][k];
				cout << x[j][k] << endl;
			}
			cout << endl;
		}
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

#define rep(i, n) for(int i = 0; i < n; i++)

double cross(const xy_t &a, const xy_t &b){
	return imag(conj(a) * b);
}

double dot(const xy_t &a, const xy_t &b){
	return real(conj(a) * b);
}

xy_t projection(const line &l, const xy_t &p){
	double t = dot(p - l.first, l.first - l.second) / norm(l.first - l.second);
	return l.first + t * (l.first - l.second);
}

bool intersectSP(const line &l, const xy_t &p){
	return abs(l.first- p) + abs(l.second - p) - abs(l.first - l.second) < EPS;
}

double distanceSP(line s, xy_t p){
	const xy_t r = projection(s, p);
	if(intersectSP(s, r)) return abs(r - p);
	return min(abs(s.first - p), abs(s.second - p));
}

char field[8][8];

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

C++: #include<bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i = 0; i < (a); i++)
#define reps(i, a, b) for(int i = (a); i < (b); i++)
#define INF 1e9
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
vector<string> rotate(vector<string> s) {
	vector<string> ret = vector<string>(8, "");
	rep(i, 8) rep(j, 8) ret[i] += s[7-j][i];
	return ret;
}
int main() {
	vector<string> s = vector<string>(8, "");
	rep(i, 8) cin >> s[i];
	vi v = {90, 180, 270};
	rep(k, v.size()) {
		cout << v[k] << endl;
		s = rotate(s);
		for(auto it : s) cout << it << endl;
	}
	return 0;
}

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

char MAP[8][9];//}bvîñ

void rotate(){//}bvð90xñ]
  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() {//}bvðoÍ
  for(int i = 0 ; i < 8 ; i++){
    printf("%s\n",MAP[i]);
  }
}
int main(){
  for(int i = 0 ; i < 8 ; i++){
    scanf("%s",MAP[i]);
  }
  for(int i = 1 ; i <= 3 ; i++) {
    printf("%d\n", 90*i);
    rotate();
    showmap();
  }
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

char s[8][9];
int main() {
	rep(i, 8)scanf("%s", s[i]);
	puts("90");
	rep(i, 8) {
		for (int j = 7; j >= 0; j--)cout << s[j][i];
		cout << endl;
	}
	puts("180");
	for (int i = 7; i >= 0; i--) {
		for (int j = 7; j >= 0; j--)cout << s[i][j];
		cout << endl;
	}
	puts("270");
	for (int i = 7; i >= 0; i--) {
		rep(j, 8)cout << s[j][i];
		cout << endl;
	}
}

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

int main(void){
	char map[8][8];
	for(int j=0;j<=7;j++){
		scanf("%s",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;
}