Problem:


Score : 200 points

Problem Statement

Iroha has a sequence of N strings S_1, S_2, ..., S_N. The length of each string is L.

She will concatenate all of the strings in some order, to produce a long string.

Among all strings that she can produce in this way, find the lexicographically smallest one.

Here, a string s=s_1s_2s_3...s_n is lexicographically smaller than another string t=t_1t_2t_3...t_m if and only if one of the following holds:

There exists an index i(1≦i≦min(n,m)), such that s_j = t_j for all indices j(1≦j<i), and s_i<t_i.

s_i = t_i for all integers i(1≦i≦min(n,m)), and n<m.

Constraints

1 ≦ N, L ≦ 100

For each i, the length of S_i equals L.

For each i, S_i consists of lowercase letters.

Input

The input is given from Standard Input in the following format:

N L
S_1
S_2
:
S_N

Output

Print the lexicographically smallest string that Iroha can produce.

Sample Input 1

3 3
dxx
axx
cxx

Sample Output 1

axxcxxdxx

The following order should be used: axx, cxx, dxx.



Sample input:
3 3
dxx
axx
cxx


Sample output:
axxcxxdxx

Submission status: Wrong Answer

Solution code:
#文字列大好きいろはちゃんイージー
import numpy as np
n,l=list(map(int,input().split( )))
s=[]
for i in range(n):
    s.append(input())
S=[]
while len(s)>0:
    a=0
    for i in range(n-a):
        if s[i]==min(s):
            S.append(s[i])
            del s[i]
            break
        a+=1

print(S)

Submission status: Wrong Answer

Solution code:
N,L =[int(i) for i in input().split()]

data = []
for i in range(N):
  data.append(input())

Submission status: Wrong Answer

Solution code:
n, l = map(int,input().split())
s = []
for i in range(n):
    s.append(input())
print(s)
s.sort()
print(s)
print("".join(s))

Submission status: Wrong Answer

Solution code:
N,L = map(int,input().split())
S = []
ans = ""
for i in range(N):
  S.append(input())
sorted(S)
for i in range(len(S)):
  ans += S[i]
print(ans)

Submission status: Wrong Answer

Solution code:
N,L = map(int,input().split())
S = []
ans = ""
for i in range(N):
  S.append(input())
sorted(S)
for i in range(len(S)):
  ans += S[i]
print(ans)

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
s=list(input() for i in range(n))
t=[]
for i in range(n):
  t.append([])
  for j in range(l):
    t[i].append(s[i][j])
    t[i].sort()
t.sort()
k=t[0]
for i in range(n-1):
  k+=t[i+1]
k=''.join(k)
print(k)

Submission status: Wrong Answer

Solution code:
#インポート
import sys

#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()

N, L = ISI()
a = ""
s = sorted([sorted(IS()) for _ in range(N)])
for i in range(N):
    a += "".join(s[i])
print(a)

Submission status: Wrong Answer

Solution code:
a_list=[]
N=int(input()[0])
for a in range (N):
    a_list.append(input())
    
a_list.sort()
print(''.join(a_list))

Submission status: Wrong Answer

Solution code:
a_list=[]
N=int(input()[0])
for a in range (N):
    a_list.append(input())
    
new_list=sorted(a_list)
print(''.join(new_list))

Submission status: Wrong Answer

Solution code:
a_list=[]
N=int(input()[0])
for a in range (N):
    a_list.append(input())
    
new_list=sorted(a_list)
string=""
for word in new_list:
    string+=str(word)
print(string)

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())

str_list = list() 

for i in range(n):
  string = ''.join(sorted(input()))
  str_list.append(string)

str_list.sort()  
  
print(''.join(str_list))

Submission status: Wrong Answer

Solution code:
n, l = (int(i) for i in input().split())
s = ["".join(sorted(input())) for i in range(n)]
s.sort()
print("".join(s))

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
s=[str(input()) for _ in range(n)]
sort_s=sorted(s)
#'間に挿入する文字列'.join([連結したい文字列のリスト])
print(''.join(s))

Submission status: Wrong Answer

Solution code:
n,l=input().split()
n,l=int(n),int(l)
s=sorted([input() for i in range(n)])
print(list(s))

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
print(sorted([input() for _ in[0]*n]),sep='')

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
lst = [''.join(sorted(input())) for _ in range(n)]
print(''.join(sorted(lst)))

Submission status: Wrong Answer

Solution code:
_=input();print("".join(sorted(list(input().split()))))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, l = map(int, input().split())
a = []
b = ''

for i in range(n):
  a.append(input())
  
a.sort(reverse=True)

for i in range(len(a)):
  b += a[i]
  
print(b)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, l = map(int, input().split())
a = []
b = ''

for i in range(n):
  a.append(input())
  
sorted(a)

for i in range(len(a)):
  b += a[i]
  
print(b)

Submission status: Wrong Answer

Solution code:
inputs=input()
s = sorted([input() for i in range(int(inputs[0]))])
print(*s,sep='')

Submission status: Wrong Answer

Solution code:
inputs=input()
Ss=[]
for _ in range(int(inputs[0])):
  Ss.append(str(input()))
Ss = sorted(Ss)
print(*Ss,sep='')

Submission status: Wrong Answer

Solution code:
N=input()
Ss=[]
for _ in range(int(N[0])):
  Ss.append(str(input()))
Ss.sort()
print(*Ss,sep='')

Submission status: Wrong Answer

Solution code:
N=input()
Ss=[]
for _ in range(int(N[0])):
  Ss.append(str(input()))
Ss.sort()
for s in Ss:
  print(s,end='')

Submission status: Wrong Answer

Solution code:
N=input()
Ss=[]
for _ in range(int(N[0])):
  Ss.append(input())
Ss.sort()
for s in Ss:
  print(s,end='')

Submission status: Wrong Answer

Solution code:
num_list = list(map(int, input().split()))
S = [input(i) for i in range(num_list[0])]
S2 = sorted(S)
print(*S2, sep='')

Submission status: Wrong Answer

Solution code:
num_list = list(map(int, input().split()))
S = [input(i) for i in range(num_list[0])]
S2 = sorted(S)
print(''.join(S2))

Submission status: Wrong Answer

Solution code:
num_list = list(map(int, input().split()))
S = [input(i) for i in range(num_list[0])]
print(''.join(sorted(S)))

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
S=[input() for i in range(n)]
print(*sorted(S))

Submission status: Wrong Answer

Solution code:
num_list = list(map(int, input().split()))
N = num_list[0]
L = num_list[1]
S = [input(i) for i in range(N)]
for i in range(N):
        for j in range(N):
                if i < j:
                        for k in range(L):
                                if S[i][k] > S[j][k]:
                                        S[i], S[j] = S[j], S[i]
                                        break
                                else:
                                        continue
p_S = ''.join(S)
print(p_S)

Submission status: Wrong Answer

Solution code:
num_list = list(map(int, input().split()))
N = num_list[0]
L = num_list[1]
S = [input(i) for i in range(N)]
for i in range(N):
        for j in range(N):
                if i < j:
                        for k in range(L):
                                if S[i][k] > S[j][k]:
                                        S[i], S[j] = S[j], S[i]
                                        break
                                else:
                                        continue
print(''.join(S))

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
''.join(sorted([input() for i in range(N)]))

Submission status: Wrong Answer

Solution code:
n,l = map(int,input().split())
s = sorted([input() for _ in range(n)])
for i in range(n):
  print(*s,sep="")

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
s=[]
for n in range(N):
  s.append(input())
"".join(sorted(s))

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
s=sorted({input() for i in range(n)})
print("".join(s))

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
S=sorted([input() for i in range(N)])
print(*S,end="")

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())

text_list = [input() for i in range(n)]
text_list.sort()

ans = ''.join(text_list[:l])
print(ans)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
l_list = [str(input()) for i in range(N)]
l_list = sorted(l_list)[:L]
ans = ''.join(l_list)
print(ans)

Submission status: Wrong Answer

Solution code:
input_N_L = input()
#print( input_N_L )
N, L = map( int, input_N_L.split() )

#print( N )
#print( L )

str_set = set()
for i in range( N ):
  str_set.add( input() )
#print( array )

sorted_str = ""
for s in sorted( str_set ):
  sorted_str += s
print( sorted_str )

Submission status: Wrong Answer

Solution code:
array = input().split()
N = array[0]
L = array[1]
strs = array[2:]
#print( strs[0] )
# print( sorted(strs) )

strs_sorted = ""
for s in sorted(strs) :
    strs_sorted += s
print ( strs_sorted )

Submission status: Wrong Answer

Solution code:
array = """3 5
axx
bxx
cxx
dxx
eee
""".split()
N = array[0]
L = array[1]
strs = array[2:]
#print( strs[0] )
# print( sorted(strs) )

strs_sorted = ""
for s in sorted(strs) :
    strs_sorted += s
print ( strs_sorted )

Submission status: Wrong Answer

Solution code:
array = input().split()
N = array[0]
L = array[1]
strs = array[2:]
print( sorted(strs) )

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
S = []
for s in open(0).read().split():
    S.append(s)

S.sort()
for s in S:
    print(s, end='')
print()

Submission status: Wrong Answer

Solution code:

alpha = [chr(ord('a') + i) for i in range(26)]

N, L = map(int, input().split())
P = [input() for i in range(N)]

scores = []

for word in P:
    score = 0
    for t in word:
        score += alpha.index(t)
    scores.append({"word": word, "score": score})

sorted_dict_list = sorted(scores, key=lambda x:x['score'])

out_str = ""
for d in sorted_dict_list:
    out_str += d["word"]
print(out_str)

Submission status: Wrong Answer

Solution code:
import itertools
N,L=map(int,input().split())
S=[]
S_list=[]
for i in range(N):
    S.append(input())
list(itertools.permutations(S)).sort()
for i in list(itertools.permutations(S)):
    S_list.append("".join(i))
print(list(S_list)[0])

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
print(n)
print(l)

input_str = []
for i in range(n):
    input_str.append(input())
input_str.sort()

mojiretu = ''.join(input_str) 
print(mojiretu)

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
s_list = sorted([input() for i in range(n)])
mojiretu = ','.join(s_list)
print(mojiretu)

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
s=[]

for i in range(N):
  s.append(input())

s.sort()
print(s)

result=""
for i in range(N):
	result+=s[i]
print(result)

Submission status: Wrong Answer

Solution code:

def alpha2num(alpha):
    num=0
    for index, item in enumerate(list(alpha)):
        num += pow(26,len(alpha)-index-1)*(ord(item)-ord('a')+1)
    return num

def string2num(str):
    _N = len(str)
    num=0
    for n in range(_N):
        num+=alpha2num(str[n])* (26**(_N-1-n))
    return num

if __name__ == "__main__":
    N,L = (int(x) for x in input().split())
    S = []
    S2Num=[]
    for n in range(N):
        _str = input()
        S.append(_str)
        S2Num.append(string2num(_str))
    print(S2Num)
    ans =""
    for key in sorted(range(len(S2Num)), key=lambda k: S2Num[k]):
        ans+=S[key]
    print(ans)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
lst = []
for _ in range(N):
  lst.append(input())
lst.sort()
print(''.join(lst[:L]))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*- 


number, length = map(int, input().split())
lst = []
for n in range(number):
    s = input()
    print(s)
    lst.append(s)
    print(lst)

lst.sort()
moji = ""
for n in lst:
    moji += n
print(moji)

Submission status: Wrong Answer

Solution code:
import itertools
N,L=map(int,input().split())
S=[input() for _ in range(N)]
print("".join(list(itertools.permutations(S))[0]))

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
s_list = [input() for i in range(n)]

s_sorted = []
for s in s_list:
    sum_s_elem = ''
    for ss in sorted(s):
        sum_s_elem += ss
    s_sorted.append(sum_s_elem)

sum_s = ''
for s in sorted(s_sorted):
    sum_s += s
print(sum_s)

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
s_list = [input() for i in range(n)]

s_sorted = []
for s in s_list:
    sum_s_elem = ''
    for ss in sorted(s):
        sum_s_elem += ss
    s_sorted.append(sum_s_elem)
print(s_sorted)

sum_s = ''
for s in sorted(s_sorted):
    sum_s += s
print(sum_s)

Submission status: Wrong Answer

Solution code:
N, L = [int(i) for i in input().split()]
s = []
for i in range(N):
    s.append(input())

s.sort()
print(s)
concat = ''.join(s)
print(concat)

Submission status: Wrong Answer

Solution code:
N, L = [int(i) for i in input().split()]
s = []
for i in range(N):
    s.append(input())

sorted(s)
concat = ''.join(s)
print(concat)

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split(" "))
ss = [input() for i in range(n)]
print(''.join(ss))

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())

list = []
for _ in range(n):
    list.append(input())

list.sort()
str = ""
for s in list:
    str += s

print(s)

Submission status: Wrong Answer

Solution code:
N , L= map(int,input().split())
lst = list()
lst2 = ''
for i in range(N):
    lst.append(input())

for j in range(N-1):
    if lst[j] > lst[j+1]:
        lst[j],lst[j+1] = lst[j+1] ,lst[j]
for k in range(N):
    lst2 += lst[k]
print(lst2)

Submission status: Wrong Answer

Solution code:
N, L=map(int, input().split())
lst = []
ans = ""
for i in range(N):
    lst.append(input())
lst.sort

for i in range(len(lst)):
    ans += lst[i]
    
print(ans)

Submission status: Wrong Answer

Solution code:
N, L=map(int, input().split())
lst = []
ans = str()
for i in range(N):
    lst.append(input())
lst.sort

for i in range(len(lst)):
    ans += lst[i]
    
print(ans)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
S = sorted([''.join(sorted(input())) for _ in range(N)])
print(''.join(S))

Submission status: Wrong Answer

Solution code:
s=input().split()
s.sort()
print(''.join(s))

Submission status: Wrong Answer

Solution code:
N,L = list(map(int,input().split(" ")))
S = [input() for i in range(N)]
S.sort()
print(S)

Submission status: Wrong Answer

Solution code:
n, l = [ v for v in input().split() ]
string_list = sorted([ v for v in input().split() ])
print("".join(string_list))

Submission status: Wrong Answer

Solution code:
n,l = map(int, input().split())

ans = input()
for i in range(n-1):
    ans = min(ans, input())
print(ans)

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
s=[input() for i in range(n)]
for i in range(n-1):
    si=s[i]
    for j in range(l):
        if si[j]>s[i+1][j]:
            s[i]=s[i+1]
            s[i+1]=si
print(''.join(s))

Submission status: Wrong Answer

Solution code:
a = sorted(list(map(str,input().split())))
b = ''.join(a)
print(b)

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
s = list()
for i in range(n):
  s.append(input())

s = sorted(s)
print(s)

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
s=sorted([input()for i in range(n)])
''.join(s)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
S = []
master = 'abcdefghijklmnopqrstuvwxyz'

def f(s1, s2, l):
    for i in range(l):
        if master.index(s1[i]) == master.index(s2[i]):
            continue
        elif master.index(s1[i]) > master.index(s2[i]):
            return 'greater'
        elif master.index(s1[i]) < master.index(s2[i]):
            return 'less'
    return 'equal'

for _ in range(N):
    if _ == 0:
        S.append(input())
    else:
        s2 = input()
        max_iter = len(S)
        for i in range(max_iter):
            compared = f(s2, S[i], L)
            if compared == 'greater' and i == max_iter-1:
                S.insert(i, s2)
            elif compared == 'greater':
                continue
            elif compared == 'less':
                S.insert(i, s2)
                break
            elif compared == 'equal':
                S.insert(i, s2)
                break

print(''.join(S))

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
S = []
master = 'abcdefghijklmnopqrstuvwxyz'

def f(s1, s2, l):
    for i in range(l):
        if master.index(s1[i]) == master.index(s2[i]):
            continue
        elif master.index(s1[i]) > master.index(s2[i]):
            return 'greater'
        elif master.index(s1[i]) < master.index(s2[i]):
            return 'less'
    return 'equal'

for _ in range(N):
    if _ == 0:
        S.append(input())
    else:
        s2 = input()
        max_iter = len(S)
        for i in range(max_iter):
            compared = f(s2, S[i], L)
            print(compared)
            print(S)
            if compared == 'greater' and i == max_iter-1:
                S.insert(i, s2)
            elif compared == 'greater':
                continue
            elif compared == 'less':
                S.insert(i, s2)
                break
            elif compared == 'equal':
                S.insert(i, s2)
                break

print(''.join(S))

Submission status: Wrong Answer

Solution code:
N, L = list(map(int,input().split()))
S = [input() for _ in range(N)]
print(sorted(S))

Submission status: Wrong Answer

Solution code:
N, L = [int(x) for x in input().split()]
print("".join(sorted([input() for _ in range(N)],reverse=False)[:L]))

Submission status: Wrong Answer

Solution code:
N, L = [int(x) for x in input().split()]
print("".join(sorted([input() for _ in range(N)],reverse=False)[:L+1]))

Submission status: Wrong Answer

Solution code:
N, L = [int(x) for x in input().split()]
print("".join(sorted([input() for _ in range(N)],reverse=False)[:-L-1:-1]))

Submission status: Wrong Answer

Solution code:
N, L = [int(x) for x in input().split()]
S = sorted([input() for _ in range(N)],reverse=True)
print("".join(S[:-L-1:-1]))

Submission status: Wrong Answer

Solution code:
N, L = [int(x) for x in input().split()]
S = list({input() for _ in range(N)})
print("".join(S[:-L-1:-1]))

Submission status: Wrong Answer

Solution code:
cnt,l = map(int,input().split())
print(''.join([input() for x in range(cnt)]))

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())

s=[]
for i in range(n):
    s.append(input())

order=sorted(s)
print(order)
ans=''.join(order)

print(ans)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
SList = []
for i in range(N):
    SList.append(input())
SList.sort()
ans = ','.join(SList)
print(ans)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
SList = []
for i in range(N):
    SList.append(input())
SList.sort()
print(','.join(SList))

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
join = ''.join

N, L = map(int, input().split())
S = [''.join(sorted(input().rstrip())) for _ in range(N)]
print(''.join(sorted(S)))

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
S = [''.join(sorted(input().rstrip())) for _ in range(N)]
list.sort(S)
print(''.join(S))

Submission status: Wrong Answer

Solution code:
def iroha_loves_strings(N: int, L: int, S: list) -> str:
    return ''.join(sorted(S))


if __name__ == "__main__":
    N = 0
    N, L = map(int, input().split())
    S = [input() for _ in range(N)]

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
mod = 1000000007


#A
"""
a = LI()
i = a.count(5)
j = a.count(7)
if i == 2 and j == 1:
    print("YES")
else:
    print("NO")
"""

#B
n,l = LI()
s = SR(n)
s.sort()
for i in s:
    print(i,end = "")
print()
#C
"""
def check(n):
    n = list(map(int,list(str(n))))
    s = 0
    for i in n:
        s += f[i]
    return s == 0
n,k = LI()
d = LI()
f = [0 for i in range(10)]
for i in d:
    f[i] = 1
while 1:
    if check(n):
        print(n)
        quit()
    n += 1
"""
#D
"""
def f(x,y):
    return fact[x-1+h-y]*fact[y-1+w-x]*inv_fact[x-1]*inv_fact[y-1]*inv_fact[w-x]*inv_fact[h-y]%mod
h,w,a,b = LI()
fact = [1]*(h+w+1)
for i in range(h+w):
    fact[i+1] = fact[i]*(i+1)%mod
inv_fact = [0]*(h+w+1)
inv_fact[h+w] = pow(fact[-1],mod-2,mod)
for i in range(h+w)[::-1]:
    inv_fact[i] = inv_fact[i+1]*(i+1)%mod
ans = 0
for i in range(1,min(w-b,h-a)+1):
    ans += f(b+i,a+i)
    ans %= mod
print(ans)
"""


#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
S = sorted([input() for x in range(N)], key=lambda x:ord(x[0]))
print("".join(S))

Submission status: Wrong Answer

Solution code:
N, L = list(map(int, input().split()))
S = [input() for i in range(N)]

Ss = sorted(S)
print(','.join(Ss))

Submission status: Wrong Answer

Solution code:
N, L = list(map(int, input().split()))
S = []
for i in range(N):
    S.extend(list(map(str, input().split())))

S = sorted(S)
print(S)

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
ans=''
for i in range(N):
  s=input()
  ans=min(ans+s,s+ans)
print(ans)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
S = [input() for _ in range(N)]
new_S = []
for word in S:
    new_S.append(''.join(sorted(word)))
ans = ''.join(sorted(new_S))
print(ans)

Submission status: Wrong Answer

Solution code:
N,L = map(int,input().split())
print(N,L)
strs = []
for _ in range(N):
    strs.append(str(input()))
strs.sort()
print(''.join(strs))

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
a=[]
for i in range(n):
    a.append(input())
sorted(a,reverse=True)
s=""
for j in a:
    s+=j
print(s)

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
a=[]
for i in range(n):
    a.append(input())
sorted(a)
s=""
for j in a:
    s+=j
print(s)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
l = list(map(str, input().split()))
l.sort()
s = ''
for i in l:
    s += i
print(s)

Submission status: Wrong Answer

Solution code:
N, L = list(map(int, input().split()))

def solve():
    print(N, L)
    strs = []
    for _ in range(N):
        strs.append(input())

    strs.sort()

    return "".join(strs)

print(solve())

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
s_list=[]
for i in range(N):
    s_list.append(input())

def moji(m,a):#a文字目を返す
    return list(m)[a]

ans = ''
for i in range(L):#1文字目から
    if len(ans) == L*N:
        break
    hantei = True
    max = '}'
    while hantei == True:
        for j in range(N):#1単語目から
            if max > moji(s_list[j],i):
                max = moji(s_list[j],i)
                maxj = j
        if max != '}':
            ans += s_list[maxj]
            s_list[maxj] = '}'*L
            max = '}'
        else:
            hantei = False
print(ans)

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
s_list=[]
for i in range(N):
    s_list.append(input())

def moji(m,a):#a文字目を返す
    return list(m)[a]

ans = ''
for i in range(L):#1文字目から
    if len(ans) == L*N:
        break
    hantei = True
    max = '}'
    while hantei == True:
        for j in range(N):#1単語目から
            if max > moji(s_list[j],i):
                max = moji(s_list[j],i)
                maxj = j
        if max != '}':
            ans += s_list[maxj]
            print(ans)
            s_list[maxj] = '}'*L
            max = '}'
        else:
            hantei = False
print(ans)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
 
#標準入力からリストの作成
list = []
for _ in range(1, N+1):
 i = input()
list.append(i)
 
#リストの結合
mojiretu = ''.join(list)
 
print(mojiretu)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
 
#標準入力からリストの作成
list = []
for _ in range(2, N+2):
 i = input()
 list.append(i)
 
#リストの結合
mojiretu = ''.join(list)
 
print(mojiretu)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
 
#標準入力からリストの作成
list = []
for _ in range(1, N+1):
 i = input()
 list.append(i)
 
#リストの結合
mojiretu = ''.join(list)
 
print(mojiretu)

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
 
#標準入力からリストの作成
list = []
for _ in range(N):
 i = input()
 list.append(i)
 
#リストの結合
mojiretu = ''.join(list)
 
print(mojiretu)

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
ans = "z" * 100
for _ in range(n):
  ans = min(ans, input())
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

lines = sys.stdin.readlines()

strings = []
max_len = 0
for n, line in enumerate(lines):
  if n == 0:
    N, L = [int(_) for _ in line.strip().split(' ')]
    continue
  max_len = max([max_len, len(line.strip())])
  strings.append([ord(_) - 97 for _ in line.strip()])
  
def append(source, target):
  global max_len
  #print('begin:', end='')
  #print(source, target)
  min_idx = -1
  check_idx = [_ for _ in range(max_len)]
  new_check_idx = []
  for digit in range(max_len):
    s_head_min = 26
    for n, s in enumerate(source):
      if not n in check_idx:
        continue
      #print('digit:{}, check_idx:{}'.format(digit, check_idx))
      if s_head_min > s[digit]:
        s_head_min = s[digit]
        min_idx = n
      elif s_head_min == s[digit]:
        new_check_idx.append(min_idx)
        new_check_idx.append(n)
    if not len(new_check_idx):
      #print('Break!')
      #print(new_check_idx)
      break
    #print('new_check!')
    check_idx = new_check_idx
    new_check_idx = []
      
  target += ''.join([chr(_ + 97) for _ in source[min_idx]])
  source.remove(source[min_idx])
  #print('end:', end='')
  #print(source, target)
  if not len(source):
    return target
  else:
    return append(source, target)
  
print(append(strings, ''))

Submission status: Wrong Answer

Solution code:
#B - 文字列大好きいろはちゃんイージー
s = input().split()
n = int(s[0])
list = []
for i in range(n):
    list.append(input())
print(list)
list.sort()
for i in range(len(list)):
    print(list[i], end='')

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
s=[input() for i in range(n)]
s.sort
print("".join(s))

Submission status: Wrong Answer

Solution code:
N, L = map(int, input().split())
S = [input() for i in range(N)]
c = 0
while c < N:
    for i in range(c, N-1):
        if S[i] > S[i+1]:
            S[i], S[i+1] = S[i+1], S[i]
    c += 1
print(''.join(S))

Submission status: Wrong Answer

Solution code:
# 

n,l=map(int,input().split())
s=[0 for i in range(n)]
for i in range(n):
    s[i]=input()

print(s)
s.sort()
print(s)
ans=""
for i in range(n):
    ans+=s[i]

print(ans)

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())

list=[input() for i in range(n)]

list.sort()
print(",".join(list))

Submission status: Wrong Answer

Solution code:
n,l=map(int, input().split())
s=[list(input()) for i in range(n)]
s.sort()
for i in s:
    print(i,end="")
print()

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())

l = []
i = 0
# while i <= n-1:
#     list[i] = list(input())
#     i += 1

l = [input() for i in range(n)]
result = sorted(l)
# print('--------------')
# print(result)
# print('--------------')
for i in range(n):
    print(result[i])

Submission status: Wrong Answer

Solution code:
n, l = map(int,input().split())
list = []
for i in range(n):
    a = input()
    list.append(a)
for i in sorted(list):
    print(i)

Submission status: Wrong Answer

Solution code:
l = []
N, L = map(int, input().split())
for i in range(N):
    s = input()
    if L == len(s):
        l.append(s)
print(''.join(l))

Submission status: Wrong Answer

Solution code:
l = []
N, L = map(int, input().split())
for i in range(N):
    l.append(input())
print(''.join(l))

Submission status: Wrong Answer

Solution code:
l=input().split()
l.sort()
ans=''
for i in l:
  ans+=i
print(ans)

Submission status: Wrong Answer

Solution code:
N,L = map(int,input().split())
S = [input() for i in range(N)]
S.sort(key=lambda x:x[0])
print(''.join(map(str, S)))

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
"".join(sorted([input() for _ in range(n)]))

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
a=[]
for i in range(N):
    a.append(input())
a.sort
s=""
for i in range(len(a)):
    s=s+a[i]
print(s)

Submission status: Wrong Answer

Solution code:
a = list(map(str,input().split( )))

line = list(map(str,input().split( )))
#print(line)
line.sort()
#print(line)

print(''.join(line))

Submission status: Wrong Answer

Solution code:
line = list(map(str,input().split( )))
#print(line)
line.sort()
#print(line)

print(''.join(line))

Submission status: Wrong Answer

Solution code:
n, l = (int(x) for x in raw_input().split())
print "".join(sorted([x for x in raw_input().split()]))

Submission status: Wrong Answer

Solution code:
n, l = map(int, input().split())
a = sorted([''.join(sorted(input())) for _ in range(n)])
print(''.join(a))

Submission status: Wrong Answer

Solution code:
ln_list = list(map(int, input().split()))
print(ln_list)
l = []
for list in range(ln_list[0]):
  l.append(input())
l.sort()
a = ''.join(l)
print(a)

Submission status: Wrong Answer

Solution code:
l = []
try:
    while True:
        l.append(input())
except:
    print(''.join(sorted(l)))

Submission status: Wrong Answer

Solution code:
a = input().split()
print(''.join(sorted(a)))

Submission status: Wrong Answer

Solution code:
n,l=map(int,input().split())
list=[input() for i in range(n)]
list.sort()
print(list)

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
S=[input() for i in range(N)]

Ts=""
T=[]
for j in range(N):
    t=j
    for i in range(N):
        Ts+=S[t]
        t+=1
        if t==N: t=0
    T.append(Ts)
    Ts=""

print(min(T))

Submission status: Wrong Answer

Solution code:
N,L=map(int,input().split())
S=[input() for i in range(N)]


Ts=""
T=[]
for j in range(N):
    t=j
    for i in range(N):
        if t==N: t=0
        Ts+=S[t]
        t+=1
    T.append(Ts)
    Ts=""

print(min(T))

Submission status: Wrong Answer

Solution code:
N=input();print(''.join(sorted([input() for i in range(int(N[0:1]))])))

Submission status: Wrong Answer

Solution code:
import sys
L, N = map(int, raw_input().split())
if L > 100 or N < 1:
 print 'error'
 exit()
 
input = []
for i in range(0, N):
 sentence = raw_input()
 if len(sentence) != L:
  print 'error'
  exit()
 for j in range(0, L):
  if sentence[j] < 'a' or sentence[j] > 'z':
   print 'error'
   exit()
 input.append(sentence)
 
answer = ""
for x in sorted(input):
    sys.stdout.write(x)