HEPNUM - Heptadecimal Numbers

no tags 

The Factory of Computer Enhaced Numbers (FCEN) has asked its Development Comitee (DC) to come up with a way to handle numbers written in base 17 As everybody knows, base 17 is very important for many scientific applications, as well as for engineering and other practical uses. Numbers in base 17 can be tough, but are kind and soft if treated appropiately.

Numbers in base 17 are written by using a set of 17 characters: digits 0 to 9 with their usual values, and uppercase letters A to G that have values from 10 to 16, respectively. Base 17, probably because its basement on a prime number, does not require numbers to start with a non-zero digit, so each number has many representations. For instance, the decimal number 117 can be written as 6F, but also as 06F or even 00000006F. Because of this leading-zeroes thing, heptadecimal numbers are hard to compare.

As a member of the FCEN-DC, you were asked to write a program that helps in this difficult and challenging task.

Input

The input contains several test cases. Each test case is described in a single line that contains two non-empty strings of at most 105 heptadecimal digits, separated by a single space. The last line of the input contains two asterisks separated by a single space and should not be processed as a test case.

Output

For each test case output a single line with the sign “<” if the first heptadecimal number is smaller than the second one, the sign “>” if the first heptadecimal number is greater than the second one, or the sign “=” if both heptadecimal numbers are equal.

Example

Input:
006F B3B
0000 0
* *

Output:
<
=

hide comments
more_practice: 2016-06-27 16:36:05

use mind 2 line of code

sri: 2015-11-11 22:40:16

Learnt something useful...Nice problem

dwij28: 2015-08-25 20:21:39

People who are talking about python being too slow for this, its not python, its your naive approach. I got an AC using python in this question.

SangKuan: 2015-08-21 10:18:39

use 10^5 + n array enough

:.Mohib.:: 2015-02-17 17:46:54

silly mistakes coast me some wa but finally AC:)...nice question...

Prikshit Kumar: 2014-04-05 17:04:01

This question has some problem with its input. When i used an array of size 10^5,it showed me segmentation error but changing the size to 10^6 gave me correct answer.

So, i suggest you all should use 10^6 array for storing the input strings.

Shreyans: 2013-12-30 07:25:03

@Pablo Ariel Heiber,
Do all test cases contain non-negative numbers, or negative numbers are also possible???
Please specify.

EDIT : Only non-negative numbers.
Silly mistake by me, just counted upto F(15) instead of G(16).

Last edit: 2014-01-25 08:01:32
@DubeY@: 2013-07-31 16:37:35

ohh..!! finally AC :)

pika_pika: 2013-07-09 14:43:47

python gives TLE and the same logic in c++ gives 0.04s AC... is python that slow. Got 2 SIGSEGV just for array size 10^5 instead of 10^5+1..

Nishant Gupta: 2013-07-07 14:43:58

test cases that may help
006F 00000000000000000006F
GGGF 00000000GGGF
00000FGD11 GFDA
0000 0000023
* *
ans:
=
=
>
<

Last edit: 2013-07-07 14:45:01

Added by:Pablo Ariel Heiber
Date:2010-08-13
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC PERL6 VB.NET
Resource:FCEyN UBA ICPC Selection 2007