Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.io.*;
- class CodeJam{
- public static void main(String[] args){
- //Scanner in = new Scanner(System.in);
- Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
- int caseq = 1;
- int t = in.nextInt();
- while(t-->0){
- String x = in.next();
- String a="";
- String b="";
- int n = x.length();
- for(int i=n-1;i>=0;i--){
- if(x.charAt(i) == '4'){
- a="2"+a;
- b="2"+b;
- }else{
- a=x.charAt(i)+a;
- b="0"+b;
- }
- }
- int start=0;
- while(b.charAt(start)=='0'){
- start++;
- }
- System.out.println("Case #"+caseq+":"+a+" "+b.substring(start));
- caseq++;
- }
- }
- }
Add Comment
Please, Sign In to add comment