Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := [10]string{
		"* = ****",
		"* =* ***",
		"* =** **",
		"* =*** *",
		"* =**** ",
		" *= ****",
		" *=* ***",
		" *=** **",
		" *=*** *",
		" *=**** ",
	}
	input := make([]string, 0)
	for scanner.Scan() {
		input = append(input, scanner.Text())
	}
	n := len(input)
	cnt := 0
	for cnt < n {
		tmp := strings.Split(fmt.Sprintf("%05s", input[cnt]), "")
		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()
		}
		if cnt != n-1 {
			fmt.Println()
		}
		cnt++
	}
}

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;
}

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

int main()
{
  int n;
  bool first = true;
  while (cin >> n) {
    vector<string> ans(8, "");
    for (int keta = 0; keta < 5; ++keta) {
      int d = n % 10;
      
      if (d >= 5) {
	ans[0] = " " + ans[0];
	ans[1] = "*" + ans[1];
      } else {
	ans[0] = "*" + ans[0];
	ans[1] = " " + ans[1];
      }
      ans[2] += "=";

      for (int i = 0; i < 5; ++i) {
	if (i == d%5)
	  ans[i+3] = " " + ans[i+3];
	else
	  ans[i+3] = "*" + ans[i+3];
      }

      n /= 10;
    }
    if (!first)
      cout << endl;
    for (unsigned int i = 0; i < ans.size(); ++i)
      cout << ans[i] << endl;
    cout << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,s,b) for(int i=(s);i<(b);i++)
#define rrep(i,s,b) for(int i=(b)-1;i>=(s);i--)
#define all(s) (s).begin(),(s).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

signed main() {
	for (int n, cnt = 0; cin >> n; cnt++) {
		if (cnt)cout << endl;
		string s[5] = {};
		rep(i, 0, 5) {
			int a = n % 10;
			if (a >= 5)s[i] += " *=";
			else s[i] += "* =";
			a %= 5;
			rep(j, 0, 4) {
				if (j == a) s[i] += " ";
				s[i] += "*";
			}
			if (a == 4)s[i] += " ";
			n /= 10;
		}
		rep(h, 0, s[0].size()) {
			string ans = "";
			//bool flag = true;
			rep(i, 0, 5) {
				//if (flag&&s[i][h] == ' ')continue;
				//flag = false;
				ans = s[i][h] + ans;
			}
			cout << ans << endl;
		}
	}
	return 0;
}

C++: # define _CRT_SECURE_NO_WARNINGS 1
# include <iostream>
# include <string>
# include <bitset>
# include <vector>
# include <algorithm>
# include <cstdlib>
# include <cstdio>
# include <cstring>
# include <cstdlib>
# include <iomanip>
# include <queue>
# include <sstream>
# include <climits>
# include <cmath>
# include <list>
# include <functional>
# include <string>
# include <ctime>
# include <set>
# include <map>
# include <stack>
# include <unordered_map>
using namespace std;
//# define M_PI 3.141592
# define INF ((int)(1<<30))
# define FOR(i,n) for(int i=0;i<(int)n;i++)
# define FORI(i,k,n) for(int i=k;i<(int)n;i++)
# define toRad 2.0*M_PI/360.0
# define inin(x) int x;cin>>x;
# define all(x) x.begin(),x.end()
# define debug(x) cout<<#x<<" :"<<x<<endl;
# define rep(i,n) for(int i=0;i<(int)n;i++)
# define EPS 1e-12
# define CHECK(i,a) FOR(i,a.size())cout<<#a<<"["<<i<<"] : "<<a[i]<<endl; 

int main()
{
	string s;
	bool f = false;
	while (cin >> s)
	{
		if (f)cout << endl;
		reverse(all(s));
		while (s.size() < 5)s += '0';
		reverse(all(s));
		f = true;
		for (int i = 0; i < s.size(); i++)
		{
			char c = '*';
			if (s[i] >= '5')
				c = ' ';
			cout << c;
		}cout << endl;
		for (int i = 0; i < s.size(); i++)
		{
			char c = ' ';
			if (s[i] >= '5')
				c = '*';
			cout << c;
		}cout << endl;
		for (int i = 0; i < s.size(); i++)
		{
			cout << '=';
		}cout << endl;

		for (int j = 0; j < 5; j++)
		{
			for (int i = 0; i < s.size(); i++)
			{
				char c = '*';
				if (s[i] == '0' + j || s[i] == '5' + j)
					c = ' ';
				cout << c;
			}cout << endl;
		}



	}

}

C++: 
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

string str[] = { "* = ****", 
				 "* =* ***",
	             "* =** **",
	             "* =*** *",
				 "* =**** ",
	             " *= ****",
	             " *=* ***",
	             " *=** **",
                 " *=*** *",
	             " *=**** "};

int main()
{
	int cnt = 0;
	string n;

	while (cin >> n) {
		if (cnt++)cout << endl;

		while (n.size() < 5)n = "0" + n;

		vector<string> s(n.size());
		rep(i, n.size()) 
			s[i] = str[n[i] - '0'];
		
		rep(i, 8) {
			rep(j, 5) {
				cout << s[j][i];
			}
			cout << endl;
		}
	}
	return 0;
}