package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String left = scanner.next(); String right = scanner.next(); if(left.length() < right.length()) { System.out.println(right); return; } if(left.length() > right.length()) { System.out.println(left); return; } for(int i = 0;i < left.length();i++) { char leftValue = left.charAt(i); char rightValue = right.charAt(i); if(leftValue == rightValue) { continue; } if(leftValue == '7' && rightValue == '4') { System.out.println(right); return; } if(leftValue == '4' && rightValue == '7') { System.out.println(left); return; } if(leftValue > rightValue) { System.out.println(left); return; } System.out.println(right); return; } } }