Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	table := []int{0, 1, 2, 3, 5, 7, 8, 9}
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		out := make([]int, 10)
		now := 0
		for n > 0 {
			out[now] = table[n%8]
			now++
			n /= 8
		}
		tmp := make([]string, 0)
		for i := now - 1; i >= 0; i-- {
			tmp = append(tmp, strconv.Itoa(out[i]))
		}
		fmt.Println(strings.Join(tmp, ""))
	}
}

Python: from sys import stdin
while(True):
    n = int(stdin.readline())
    if not n:
        break
    print(str(oct(n))[2:].translate(str.maketrans('4567','5789')))

Python: while True:
    n = int(input())
    if n == 0:
        break
    print(str(oct(n)[2:]).translate(str.maketrans("4567", "5789")))

Python: while(1):
    n = int(input())
    if(not n):
        break
    print("".join("01235789"[int(i)] for i in oct(n)[2:]))

Python: while True:
    x=int(input())
    if x==0:
        break
    x = oct(x)[2:]
    print(x.translate(str.maketrans('4567', '5789')))

Python: def ge(arr):
    for i in range(len(arr)):
        tmp = int(arr[i])
        if tmp >= 4:
            tmp += 1
        if tmp >= 6:
            tmp += 1
        arr[i] = str(tmp)


while True:
    n = int(input)
    if n == 0:
        break
    print("".join(ge(list(oct(n))[2:])))

Python: import sys
l=sys.stdin.readlines()
for i in l[:-1]:print(oct(int(i))[2:].translate(str.maketrans("4567","5789")))

Python: def base10to8(n):

    ans = ""
    while n > 0:
        ans = str(n % 8) + ans
        n = n // 8

    return ans


while True:

    n = int(input())
    if n == 0:
        break

    s = base10to8(n)

    table = [0,1,2,3,5,7,8,9]
    for i in range(len(s)):
        print(table[int(s[i])], end="")
    print("")

Python: while 1:
    c=input()
    if c=="0":break
    print(format(int(c),'o').translate(str.maketrans({"4":"5","5":"7","6":"8","7":"9"})))

Python: while True:
    n = int(input())
    if n == 0:
        break
    cnt = 1
    for i in range(1, n+1):
        tmp = str(cnt)
        while '4' in tmp or '6' in tmp:
            if '4' in tmp and '6' in tmp:
                l = min(tmp.find('4'), tmp.find('6'))
                r = len(tmp[l+1:])
                cnt += 1*pow(10, r)
            elif '4' in tmp:
                l = tmp.find('4')
                r = len(tmp[l+1:])
                cnt += 1*pow(10, r)
            else:
                l = tmp.find('6')
                r = len(tmp[l+1:])
                cnt += 1*pow(10, r)
            tmp = str(cnt)
        cnt += 1
    print(cnt-1)

Python: def testcase_ends():
    n = int(input())
    if n == 0:
        return 1

    n = oct(n)[2:]
    print(*['01235789'[int(i)] for i in n], sep='');
    return 0

def main():
    while not testcase_ends():
        pass

if __name__ == '__main__':
    main()

Python: # coding: utf-8
# Your code here!

a={'0':'0','1':'1','2':'2','3':'3','4':'5','5':'7','6':'8','7':'9'}


while True:
    n=int(input())
    if n==0:
        break
    
    else:
        N=list(format(n,"o"))   #8進法
        
    for i in range(len(N)):
        print(a[N[i]],end="")
    print()

Python: while(1):
    n = int(input())
    if(not n):
        break
    print("".join("01235789"[int(i)] for i in oct(n)[2:]))

Python: # AOJ 0208 Room Numbers of a Hospital
# Python3 2018.6.23 bal4u
# 8進数に変換して、01234567を01235789に置き換える

tbl = ('0','1','2','3','5','7','8','9')
while 1:
	n = int(input())
	if n == 0: break
	s = format(n, 'o')
	ans = ''
	for i in range(len(s)): ans += tbl[int(s[i])]
	print(ans)

Python: dic = {"0":"0", "1":"1", "2":"2", "3":"3",
       "4":"5", "5":"7", "6":"8", "7":"9"}
def trans(n):
  if n == 0:
    return "0"
  acc = ""
  while n:
    acc += dic[str(n % 8)]
    n //= 8
  return acc[::-1]

while True:
  n = int(input())
  if n == 0:
    break
  print(trans(n))

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0208

"""
import sys
from sys import stdin
from bisect import bisect_left
input = stdin.readline


def solve(num):
    ans = []
    o_txt = oct(num)[2:]

    for o in o_txt:
        if int(o) >= 6:
            ans.append(int(o) + 2)
        elif int(o) == 5:
            ans.append(7)
        elif int(o) >= 4:
            ans.append(int(o) + 1)
        else:
            ans.append(int(o))
    return ans


def main(args):
    while True:
        num = int(input())
        if num == 0:
            break
        ans = solve(num)
        print(*ans, sep='')


if __name__ == '__main__':
    main(sys.argv[1:])

C++: #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

map<ll, ll> memo;
ll calc(ll n, ll digit) {
  if (n == digit * 10 - 1 && memo.count(n)) { return memo[n]; }
  ll ret = 0;
  int d = n / digit;
  if (digit == 1) {
    if (d >= 6) { ret--; }
    if (d >= 4) { ret--; }
    ret += d + 1;
  } else {
    if (n / digit == 0) { return calc(n, digit / 10); }
    if (d == 4) {
      ret = 4 * calc(digit - 1, digit / 10);
    } else if (d == 6) {
      ret = 5 * calc(digit - 1, digit / 10);
    } else {
      if (d >= 6) { d -= 2; }
      else if (d >= 4) { d -= 1; }
      ret = d * calc(digit - 1, digit / 10);
      ret += calc(n % digit, digit / 10);
    }
  }
  if (n == digit * 10 - 1) { memo[n] = ret; }
  return ret;
}

int main() {
  ll n;
  while (scanf("%lld", &n), n) {
    ll left = n;
    ll right = 10000000000LL;
    while (left != right) {
      ll mid = (left + right) / 2;
      if (calc(mid, 1000000000) - 1 < n) {
        left = mid + 1;
      } else {
        right = mid;
      }
    }
    printf("%lld\n", left);
  }
}

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

int d[]={0,1,2,3,5,7,8,9};

void solve(int n){
  if(8<=n){
    solve(n/8);
  }
  cout<<d[n%8];
  return;
}

int main(void){
  int  n;
  while(cin>>n&&n!=0){
    solve(n);
    cout<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

const int V[8] = {0, 1, 2, 3, 5, 7, 8, 9};

ll hatisin(ll a) {
  ll res = 0;
  ll i = 1;
  int t = 0;
  while(a > 0) {
    t = a % 8;
    res += t * i;
    a /= 8;
    i *= 10;
  }
  return res;
}

ll fukkatu(ll b) {
  ll res = 0;
  ll i = 1;
  int t = 0;
  while(b > 0) {
    t = b % 10;
    res += V[t] * i;
    i *= 10;
    b /= 10;
  }
  return res;
}

int main() {
  ll res;
  while(true) {
    cin >> res;
    if (res == 0) break;
    cout << fukkatu(hatisin(res)) << endl;
  }
  
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;
int main(){
  int n;
  char room[11];

  while(cin >> n, n){
    //printf("%o\n", n);
    sprintf(room, "%o", n);
    for(int i = 0 ; i <= 10 ; i++){
      if(room[i] < '4') continue;
      else if(room[i] == '4') room[i] = '5';
      else if(room[i] > '4') room[i] += 2;
    }
    cout << room << endl;
  }
  return 0;
}