MD5

Input:
String
Output:
All numers from md5($string) in ascending order in the first line
All letters from md5($string) in lexicographic order in the 2nd line

IN

hello!

OUT

012356789
abde

IN

md5

OUT

12346789
abcdf

IN

-=-x$vik-jagc-md5-task$x-=-

OUT

012345789
abcde
Login to submit solution


1 symbols perl failed test 1 Wrong answer

                      
instead of
012356789
abde
Tue Jul 29 19:35:52 2014 avkhozov
1
320 symbols python3 failed test 1 Wrong answer
01222333556777788899
aaabbddddddde
instead of
012356789
abde
Fri Aug 1 01:28:04 2014 PixelIndigo
import hashlib
s = input().encode('utf-8')
md5 = hashlib.md5()
md5.update(s)
s = str(md5.hexdigest())
digits = []
letters = []
digits.append('2')
for x in s:
    if('0' <= x <= '9'):
        digits.append(x)
    else:
        letters.append(x)
digits.sort()
letters.sort()
print(''.join(digits))
print(''.join(letters))
301 symbols python3 failed test 1 Wrong answer
0122333556777788899
aaabbddddddde
instead of
012356789
abde
Fri Aug 1 01:28:42 2014 PixelIndigo
import hashlib
s = input().encode('utf-8')
md5 = hashlib.md5()
md5.update(s)
s = str(md5.hexdigest())
digits = []
letters = []
for x in s:
    if('0' <= x <= '9'):
        digits.append(x)
    else:
        letters.append(x)
digits.sort()
letters.sort()
print(''.join(digits))
print(''.join(letters))
308 symbols python3 failed test 1 Code error

Traceback (most recent call last): File "./code", line 1, in <module> from hashlb import md5 ImportError: No module named 'hashlb'

Fri Aug 1 03:05:52 2014 vik
from hashlb import md5
s=input().encode('utf-8')
md5().update(s)
s=str(md5.hexdigest())
digits,letters=[],[]
for x in s:
 if('0' <= x <= '9'):
  if(x not in digits):
   digits.append(x)
  elif(x not in letters):
   letters.append(x)
digits.sort()
letters.sort()
print(''.join(digits))
print(''.join(letters))
309 symbols python3 failed test 1 Code error

Traceback (most recent call last): File "./code", line 4, in <module> s=str(md5.hexdigest()) AttributeError: 'builtin_function_or_method' object has no attribute 'hexdigest'

Fri Aug 1 03:06:13 2014 vik
from hashlib import md5
s=input().encode('utf-8')
md5().update(s)
s=str(md5.hexdigest())
digits,letters=[],[]
for x in s:
 if('0' <= x <= '9'):
  if(x not in digits):
   digits.append(x)
  elif(x not in letters):
   letters.append(x)
digits.sort()
letters.sort()
print(''.join(digits))
print(''.join(letters))
330 symbols python3 failed test 1 Code error

File "./code", line 8 if !(x in digits): ^ SyntaxError: invalid syntax

Fri Aug 1 03:09:37 2014 vik
import hashlib
s=input().encode('utf-8')
md5=hashlib.md5()
md5.update(s)
digits,letters,s=[],[],str(md5.hexdigest())
for x in s:
    if '0'<=x<='9':
        if !(x in digits):
            digits.append(x)
    elif !(x in letters):
        letters.append(x)
digits.sort()
letters.sort()
print(''.join(digits)+"\n"+''.join(letters))
288 symbols python3 failed test 1 Code error

File "./code", line 14 print(''.join(digits)+" ^ SyntaxError: EOL while scanning string literal

Fri Aug 1 03:13:58 2014 vik
import hashlib
s=input()
md5=hashlib.md5()
md5.update(s)
digits,letters,s=[],[],str(md5.hexdigest())
for x in s:
 if '0'<=x<='9':
  if x not in digits:
   digits.append(x)
 elif x not in letters:
  letters.append(x)
digits.sort()
letters.sort()
print(''.join(digits)+"
"+''.join(letters))
289 symbols python3 failed test 1 Code error

Traceback (most recent call last): File "./code", line 4, in <module> md5.update(s) TypeError: Unicode-objects must be encoded before hashing

Fri Aug 1 03:14:25 2014 vik
import hashlib
s=input()
md5=hashlib.md5()
md5.update(s)
digits,letters,s=[],[],str(md5.hexdigest())
for x in s:
 if '0'<=x<='9':
  if x not in digits:
   digits.append(x)
 elif x not in letters:
  letters.append(x)
digits.sort()
letters.sort()
print(''.join(digits)+"\n"+''.join(letters))
272 symbols python3 failed test 1 Code error

Traceback (most recent call last): File "./code", line 7, in <module> digits.append(x) AttributeError: 'set' object has no attribute 'append'

Fri Aug 1 03:18:18 2014 vik
import hashlib
s,md5=input().encode('utf-8'),hashlib.md5()
md5.update(s)
digits,letters,s=set(),set(),str(md5.hexdigest())
for x in s:
 if '0'<=x<='9':
   digits.append(x)
 else:
  letters.append(x)
digits.sort()
letters.sort()
print(''.join(digits)+"\n"+''.join(letters))
266 symbols python3 failed test 1 Code error

Traceback (most recent call last): File "./code", line 10, in <module> digits.sort() AttributeError: 'set' object has no attribute 'sort'

Fri Aug 1 03:19:09 2014 vik
import hashlib
s,md5=input().encode('utf-8'),hashlib.md5()
md5.update(s)
digits,letters,s=set(),set(),str(md5.hexdigest())
for x in s:
 if '0'<=x<='9':
   digits.add(x)
 else:
  letters.add(x)
digits.sort()
letters.sort()
print(''.join(digits)+"\n"+''.join(letters))
216 symbols python3 failed test 1 Code error

Traceback (most recent call last): File "./code", line 4, in <module> d,l,s=set(),set(),str(md5.hexdigest()) NameError: name 'md5' is not defined

Fri Aug 1 03:21:44 2014 vik
import hashlib
s,m=input().encode('utf-8'),hashlib.md5()
m.update(s)
d,l,s=set(),set(),str(md5.hexdigest())
for x in s:
 if '0'<=x<='9':
   d.add(x)
 else:
  l.add(x)
print(''.join(sorted(d))+"\n"+''.join(sorted(l)))
203 symbols python3 failed test 1 Code error

File "./code", line 5 d,l=filter(lambda x:x<':',s),l = filter(lambda x:x>'9',s) ^ SyntaxError: can't assign to function call

Fri Aug 1 14:09:16 2014 PixelIndigo
import hashlib as h
m=h.md5()
m.update(input().encode('utf-8'))
s=set(x for x in m.hexdigest())
d,l=filter(lambda x:x<':',s),l = filter(lambda x:x>'9',s)
print(''.join(sorted(d))+"\n"+''.join(sorted(l)))
154 symbols python3 failed test 1 Wrong answer
283976015
dbea
instead of
012356789
abde
Sun Aug 3 15:01:15 2014 vik
import hashlib as h
m=h.md5()
m.update(input().encode('utf8'))
s=set(m.hexdigest())
print(''.join([x for x in s if x<':']+['\n']+[x for x in s if x>'9']))
158 symbols perl failed test 2 Wrong answer
012356789
abde
instead of
12346789
abcdf
Mon Aug 4 11:24:59 2014 dvinciguerra
use Digest::MD5 qw[md5_hex];
(%n,%a);
map{(/\d/)? $n{$_}=1 : $a{$_}=1} split(//, md5_hex 'hello!');
print join('', sort keys %n)."\n". join('', sort keys %a);
93 symbols python3 failed test 1 Code error

File "./code", line 5 print s ^ SyntaxError: Missing parentheses in call to 'print'

Wed Aug 6 04:35:45 2014 vik
import hashlib as h
m=h.md5()
m.update(raw_input())
s=str(sorted(set(m.hexdigest())))
print s
93 symbols python2 failed test 1 Wrong answer
['0', '1', '2', '3', '5', '6', '7', '8', '9', 'a', 'b', 'd', 'e']
instead of
012356789
abde
Wed Aug 6 04:35:53 2014 vik
import hashlib as h
m=h.md5()
m.update(raw_input())
s=str(sorted(set(m.hexdigest())))
print s
142 symbols python2 failed test 1 Code error

File "./code", line 6 print "".join(s[s.index('9'):] ^ SyntaxError: invalid syntax

Wed Aug 6 04:37:16 2014 vik
import hashlib as h
m=h.md5()
m.update(raw_input())
s=sorted(set(m.hexdigest()))
print "".join(s[:s.index('9')]
print "".join(s[s.index('9'):]
143 symbols python2 failed test 1 Code error

File "./code", line 6 print "".join(s[s.index('9')::] ^ SyntaxError: invalid syntax

Wed Aug 6 04:37:49 2014 vik
import hashlib as h
m=h.md5()
m.update(raw_input())
s=sorted(set(m.hexdigest()))
print "".join(s[:s.index('9')]
print "".join(s[s.index('9')::]
143 symbols python2 failed test 1 Code error

File "./code", line 7 ^ SyntaxError: invalid syntax

Wed Aug 6 04:38:41 2014 vik
import hashlib as h
m=h.md5()
m.update(raw_input())
s=sorted(set(m.hexdigest()))
print "".join(s[:s.index('9')]
#print "".join(s[s.index('9'):]
144 symbols python2 failed test 1 Wrong answer
01235678
9abde
instead of
012356789
abde
Wed Aug 6 04:39:02 2014 vik
import hashlib as h
m=h.md5()
m.update(raw_input())
s=sorted(set(m.hexdigest()))
print "".join(s[:s.index('9')])
print "".join(s[s.index('9'):])

View all solutions