Untitled

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
561 B
10
Indexable
Never
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define DIM 200007
#define INF 2147483646
#define llmx 9223372036854775807
#define endl "\n"

using namespace std;

bool cmp(int x,int y){return x>y;}

int change(int a)
{
  int res=0,d=1;
  while(a>0)
  {
    if(a%10==1)
        res=2*d+res;
     else
        if(a%10==2)
         res=1*d+res;
          else res=a%10*d+res;
    a/=10;
    d*=10;
  }
  return res;
}

int main()
{_
 int n,a;
 cin>>n;
 for(int i=1;i<=n;i++)
 {
     cin>>a;
     cout<<change(a)<<endl;
 }
}