Go: package main

import (
	"bufio"
	"fmt"
		"os"
	"strconv"
	"strings"
	)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := [10]string{
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** ",
	}
	for scanner.Scan() {
		tmp := strings.Split(fmt.Sprintf("%05s", scanner.Text()), "")
		ans := make([]string, 0)
		for _, v := range tmp {
			iv, _ := strconv.Atoi(v)
			ans = append(ans, table[iv])
		}
		for i := 0; i < 8; i++ {
			for j := 0; j < 5; j++ {
				fmt.Print(string(ans[j][i]))
			}
			fmt.Println()
		}
	}
}

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int L = 8;

int main() {
  string v[10];
  v[0] = "* = ****";
  v[1] = "* =* ***";
  v[2] = "* =** **";
  v[3] = "* =*** *";
  v[4] = "* =**** ";
  v[5] = " *= ****";
  v[6] = " *=* ***";
  v[7] = " *=** **";
  v[8] = " *=*** *";
  v[9] = " *=**** ";
  string s;
  bool f = false;
  while(cin >>s){
    if(f) cout <<endl;
    f = true;
    stringstream ss[L];
    while(s.length() < 5) s = "0" + s;
    REP(i, s.length()) REP(j, v[s[i] - '0'].length()) ss[j] << v[s[i] - '0'][j];
    REP(i, L) cout <<ss[i].str() <<endl;
  }
  return 0;
}

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

int main(){
	bool f=false;
	int n,i,j;
	int a[5];
	char a0[11][10]={"* = ****","* =* ***","* =** **","* =*** *","* =**** "," *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "};
	while((cin>>n)!="EOF"){
		if(f==true) cout<<endl;
	a[0]=n/10000;
	a[1]=(n-a[0]*10000)/1000;
	a[2]=(n-a[0]*10000-a[1]*1000)/100;
	a[3]=(n-a[0]*10000-a[1]*1000-a[2]*100)/10;
	a[4]=(n-a[0]*10000-a[1]*1000-a[2]*100-a[3]*10);
	for(i=0;i<8;i++){
		for(j=0;j<5;j++){
			cout<<a0[a[j]][i];
		}
		cout<<endl;
	}
	f=true;
	}
	return 0;
}

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

int main(){
  int i,j,a,b,c,con=0;
  while(cin >> a){
    if(con != 0) cout << endl;
    con++;
    for(j=0;j<=5;j+=5){
      b = a;
      for(i=10000;i>=1;i/=10){
	if(b/i == j || b/i == j+1 || b/i == j+2 || b/i == j+3 || b/i == j+4) cout << "*";
	else cout << " ";

        c = b / i;
	b = b - c * i;

      }
      cout << endl;
    }
    
    cout << "=====" << endl;
    
    for(j=0;j<5;j++){
      b = a;
      for(i=10000;i>=1;i/=10){
	if(b/i == j || b/i == j+5) cout << " ";
	else cout << "*";

	c = b / i;
	b = b - c * i;

      }
      cout << endl;
    }
  }
  return 0;
}

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

int main() {
  int n;
  int a[5];
  bool b[5], first;
  first = true;
  while (cin >> n) {
    for (int i=0; i<5; i++) {
      a[i] = n % 10;
      n /= 10;
    }
    reverse(a, a+5);
    for (int i=0; i<5; i++) {
      if (a[i] < 5) {
        b[i] = false;
      } else {
        a[i] -= 5;
        b[i] = true;
      }
    }
    if (!first) cout << endl;
    for (int i=0; i<5; i++) cout << (b[i] ? ' ' : '*');
    cout << endl;
    for (int i=0; i<5; i++) cout << (b[i] ? '*' : ' ');
    cout << endl;
    for (int i=0; i<5; i++) cout << '=';
    cout << endl;
    for (int i=0; i<5; i++) {
      for (int j=0; j<5; j++) {
        cout << ((i == a[j]) ? ' ' : '*');
      }
      cout << endl;
    }
    first = false;
  }
  return 0;
}

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

char pos[10][8] = {
  {'*', ' ', '=', ' ', '*', '*', '*', '*'},
  {'*', ' ', '=', '*', ' ', '*', '*', '*'},
  {'*', ' ', '=', '*', '*', ' ', '*', '*'},
  {'*', ' ', '=', '*', '*', '*', ' ', '*'},
  {'*', ' ', '=', '*', '*', '*', '*', ' '},
  {' ', '*', '=', ' ', '*', '*', '*', '*'},
  {' ', '*', '=', '*', ' ', '*', '*', '*'},
  {' ', '*', '=', '*', '*', ' ', '*', '*'},
  {' ', '*', '=', '*', '*', '*', ' ', '*'},
  {' ', '*', '=', '*', '*', '*', '*', ' '},
};

int main() {
  int n, abcus[8][5], time = 0;
  while(cin >> n) {
    if(time++ > 0) cout << endl;
    char ans[8][5];
    int reed = 10000;
    int cnt = 0;
    while(cnt < 5) {
      int num = n/reed;
      for(int i = 0; i < 8; i++) {
        ans[i][cnt] = pos[num][i];
      }
      if(num > 0) n -= num * reed;
      reed /= 10;
      cnt++;
    }
    for(int i = 0; i < 8; i++) {
      for(int j = 0; j < 5; j++) {
       printf("%c", ans[i][j]);
      }
      cout << endl;
    }
  }
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());

string a="**=*****";
int main(){
	int n;
	while(cin>>n){
		stringstream ss[8];
		int b=10000;
		rep(i,5){
			int t=n/b;
			n%=b;
			b/=10;
			string ans=a;
			if(t>4) ans[0]=' ';
			else ans[1]=' ';
			ans[3+t%5]=' ';
			rep(j,8){
				ss[j]<<ans[j];
			}
		}
		// cout<<"hoge\n";
		rep(i,8){
			string tmp;
			getline(ss[i],tmp);
			cout<<tmp<<endl;
		}
		cout<<endl;
	}
}

C++: //Name: Abacus
//Level: 2
//Category: 文字列
//Note: 

/**
 * やり方は色々あるが、最初に全体が収まるバッファを取っておき、1桁ずつ埋めていくとよい。
 *
 * オーダーは O(log N)。
 */
#include <iostream>
#include <string>
#include <vector>

using namespace std;

bool solve(bool first) {
    int N;
    if(!(cin >> N)) return false;

    if(!first) cout << endl;
    vector<string> f(8, string(5, ' '));
    for(int i = 4; i >= 0; --i) {
        int d = N % 10;
        N /= 10;

        f[2][i] = '=';
        if(d >= 5) {
            f[1][i] = '*';
            d -= 5;
        } else {
            f[0][i] = '*';
        }
        for(int j = 0; j < 5; ++j) {
            if(d == j) continue;
            f[j+3][i] = '*';
        }
    }
    for(const string &s : f) {
        cout << s << endl;
    }
    return true;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout.setf(ios::fixed);
    cout.precision(10);

    bool first = true;
    while(solve(first)) {
        first = false;
    }
    return 0;
}

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

int main() {
	
	string s;
	string ab[10]={"* = ****","* =* ***","* =** **","* =*** *","* =**** "," *= ****"," *=* ***"," *=** **"," *=*** *"," *=**** "};
	string res[8];
	int t=0;
	
	while(cin>>s){
		if(t)cout<<endl;
		++t;
		
		for(int i=0;i<8;++i)res[i]="";
		
		int l=s.length();
		
		for(int i=0;i<5-l;++i){
			s = "0" + s;
		}
		
		for(int j=0;j<5;++j){
			for(int i=0;i<8;++i){
				res[i] += ab[s[j]-'0'][i];
			}
		}
		for(int i=0;i<8;++i){
			cout<<res[i]<<endl;
		}
	}
	return 0;
}