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 <algorithm>
#include <cstdio>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;

char M[8][8];

void printRotate(int n) {
  const static int s90n[4] = {0,1,0,-1};
  const static int c90n[4] = {1,0,-1,0};
  n = (4-n);
  rep(y, 8) {
    rep(x, 8) {
      int nx = x*c90n[n] - y*s90n[n];
      int ny = x*s90n[n] + y*c90n[n];
      if(n == 1 || n == 2) nx += 7;
      if(n == 2 || n == 3) ny += 7;
      cout << M[ny][nx];
    }
    cout << endl;
  }
}

void solve() {
  rep(i, 3) {
    cout << (i+1) * 90 << endl;
    printRotate(i+1);
  }
}

main() {
  rep(i, 8) rep(j, 8) cin >> M[i][j];
  solve();
}

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

// 8*8Ìp^[ð90xñ]³¹é
vector<string> rot(vector<string>& m){
	vector<string> m_(8);
	for(int y=0 ; y < 8 ; y++ )
		m_[y] = "********";
	for(int y=0 ; y < 8 ; y++ ){
		for(int x=0 ; x < 8 ; x++ ){
			m_[x][7-y] = m[y][x];
		}
	}
	return m_;
}

// 8*8Ìp^[ðoÍ
void output(const vector<string>& m){
	for(int y=0 ; y < 8 ; y++ )
		cout << m[y] << endl;
}

int main(){
	vector<string> m(8);
	for(int y=0 ; y < 8 ; y++ ){
		cin >> m[y];
	}
	for(int i=1 ; i <= 3 ; i++ ){
		m = rot( m );
		cout << 90*i << endl;
		output( m );
	}
}

C++: #include <iostream>

using namespace std;
char field[9][9];

void solve()
{
	for(int i = 0; i < 8; ++i)
	{
		for(int j = 0; j < 8; ++j)
		{
			cin >> field[i][j];
		}
	}
	cout << 90 << endl;
	for(int i = 0; i < 8; ++i)
	{
		for(int j = 7; j >= 0; --j)
		{
			cout << field[j][i];
		}
		cout << endl;
	}
	cout << 180 << endl;
	for(int i = 7; i >= 0; --i)
	{
		for(int j = 7; j >= 0; --j)
		{
			cout << field[i][j];
		}
		cout << endl;
	}
	cout << 270 << endl;
	for(int i = 7; i >= 0; --i)
	{
		for(int j = 0; j < 8; ++j)
		{
			cout << field[j][i];
		}
		cout << endl;
	}
}

int main()
{
	solve();
	return(0);
}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

template<typename V>
void rotate(const V &s, V &t) {
  if (!s.size()) return;
  int h = s[0].size(), w = s.size();
  rep(i, h) rep(j, w) t[j][h - i - 1] = s[i][j];
}

void solve() {
  vs s(8);
  rep(i, 8) cin >> s[i];
  loop(i, 1, 4) {
    cout << i * 90 << endl;
    vs t(8, string(8, ' '));
    rotate(s, t);
    s = t;
    rep(i, 8) cout << s[i] << endl;
  }
}

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>
using namespace std;

char m[8][9];

void disp(){
  for(int i=0; i<8; i++)
    cout << m[i] << endl;
}

void rot(){
  for(int i=0; i<4; i++)
    for(int j=0; j<4; j++){
      char c = m[i][j];
      m[i][j] = m[7-j][i];
      m[7-j][i] = m[7-i][7-j];
      m[7-i][7-j] = m[j][7-i];
      m[j][7-i] = c;
    }
}

int main(void){
  for(int i=0; i<8; i++)
    cin >> m[i];
  //disp();
  rot();
  cout << 90 << endl;
  disp();
  rot();
  cout << 180 << endl;
  disp();
  rot();
  cout << 270 << endl;
  disp();
  return 0;
}

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

C++: #include <cstdio>
#include <cctype>
#include <utility>
#include <array>
using namespace std;

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _ot _il void out
#define _ol _il void outl
_ot(bool b) {pcu('0'+b);}
_ot(const char *s){while(*s)pcu(*s++);}
_ot(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_ot(string s){for(char c:s)pcu(c);}
#endif
_T _ot(T n){static char buf[20];char *p=buf;if(n<0)pcu('-'),n*=-1;
	if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10; while (p!=buf)pcu(*--p);}
_ol(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _ot(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _ot(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _ol(T&&... t){out(move(t)...);outl();}

int main() {
	array<string, 8> a;
	for (auto &y: a)
		scan(y);
	int i, j, go[] = {0, 8, 1}, back[] = {7, -1, -1};
	const struct {int r, *i, *j, &x, &y;} tr[] =
		{90, go, back, i, j, 180, back, back, j, i, 270, back, go, i, j};
	auto loop = [](int o[], int &k, auto f) {
		for (k = o[0]; k != o[1]; k += o[2]) f();};
	for (auto &t: tr) {
		outl(t.r);
		loop(t.i, i, [&] {
			 loop(t.j, j, [&] {
				  out(a[t.y][t.x]);});
			 outl();});
	}
}