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 <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

char c[8][8];

int main(){
	REP(i, 8){
		REP(j, 8){
			cin >> c[i][j];
		}
	}
	cout << 90 << endl;
	for (int i = 7; i >= 0; i--){
		for (int j = 0; j < 8; j++){
			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 i = 0; i < 8; i++){
		for (int j = 7; j >= 0; j--){
			cout << c[i][j];
		}
		cout << endl;
	}
}

C++: #include <iostream>

#define BOARD_SIZE 8

void show(char a[][BOARD_SIZE])
{
	for (int i=0; i<BOARD_SIZE; i++) {
		for (int j=0; j<BOARD_SIZE; j++) std::cout << a[i][j];
		std::cout << std::endl;
	}
}

void copy(char a[][BOARD_SIZE], char b[][BOARD_SIZE])
{
	for (int i=0; i<BOARD_SIZE; i++) {
		for (int j=0; j<BOARD_SIZE; j++) a[i][j] = b[i][j];
	}
}

void rotate(char a[][BOARD_SIZE])
{
	char b[BOARD_SIZE][BOARD_SIZE];
	for (int i=0; i<BOARD_SIZE; i++) {
		for (int j=0; j<BOARD_SIZE; j++) b[i][j] = a[BOARD_SIZE-1-j][i];
	}
	copy(a, b);
}

int main()
{
	char board[BOARD_SIZE][BOARD_SIZE];
	for (int i=0; i<BOARD_SIZE; i++) {
		for (int j=0; j<BOARD_SIZE; j++) std::cin >> board[i][j];
	}
	for (int d=90; d<=270; d+=90) {
		std::cout << d << std::endl;
		rotate(board);
		show(board);
	}
	
	return 0;
}

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(i, 0, 8) {
		rrep(j, 0, 8) {
			cout << v[j][i];
		}
		cout << endl;
	}
	
	cout << 180 << endl;
	rrep(i, 0, 8) {
		rrep(j, 0, 8) {
			cout << v[i][j];
		}
		cout << endl;
	}

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

	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)

typedef unsigned long long ull;

int main(){
	string s[8]; FOR(i,8) cin>>s[i];
	cout << 90 << endl;
	FOR(i,8){ FOR(j,8) putchar(s[7-j][i]); putchar('\n'); }  
	cout << 180 << endl;
	FOR(i,8){ FOR(j,8) putchar(s[7-i][7-j]); putchar('\n'); }  
	cout << 270 << endl;
	FOR(i,8){ FOR(j,8) putchar(s[j][7-i]); putchar('\n'); }  

	return 0;
}

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

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

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

void rotate(char t[10][10]){
	char tmp[10][10];

	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			tmp[j][7-i] = t[i][j];
		}
	}

	for(int i=0;i<8;i++){
		for(int j=0;j<8;j++){
			t[i][j] = tmp[i][j];
		}
	}
}

int main(void){
	char t[10][10];

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

	for(int i=1;i<=3;i++){
		cout<<90*i<<endl;
		rotate(t);
		for(int j=0;j<8;j++){
			cout<<t[j]<<endl;
		}
	}

	return 0;
}

C++: #include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
int main(){
  char in[8][8];
  rep(i,8)cin>>in[i];
  
  cout<<"90"<<endl;
  rep(i,8){
    rep(j,8)cout<<in[7-j][i];
    cout<<endl;
  }
  cout<<"180"<<endl;
  rep(i,8){
    rep(j,8)cout<<in[7-i][7-j];
    cout<<endl;
  }
  cout<<"270"<<endl;
  rep(i,8){
    rep(j,8)cout<<in[j][7-i];
    cout<<endl;
  }
  return 0;
}

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

char data[9][9];
char out[9][9]; //出力用

void rotation90(){

  for(int i=0; i<8; i++) {
    for(int j=0; j<8; j++) {
      out[i][j] = data[7-j][i];
    }
  }

  for(int i=0; i<8; i++) {
    for(int j=0; j<8; j++) {
      cout<< out[i][j];
      data[i][j] = out[i][j];
    }
    cout<< endl;
  }

}

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

  for(int i=1; i<4; i++) {
    cout<< 90*i<< endl;
    rotation90();
  }

}

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;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	vs a(8);
	rep(i,8)
		cin>>a[i];
	vs b(8,string(8,' '));
	rep(k,3){
		rep(i,8)
			rep(j,8)
				b[i][j]=a[7-j][i];
		cout<<(k+1)*90<<endl;
		rep(i,8){
			rep(j,8)
				cout<<b[i][j];
			cout<<endl;
		}
		a=b;
	}
	
	return 0;
}