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:
L, N = map(int, raw_input().split())
if L > 100 or L < 1:
 print 'error'
 exit()
if N > 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)
for x in sorted(input):
    print x

Submission status: Wrong Answer

Solution code:
L, N = map(int, raw_input().split())
if L > 100 or L < 1:
 print 'error'
 exit()
if N > 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):
    answer+=x
print answer

Submission status: Wrong Answer

Solution code:
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):
    answer+=x
print answer

Submission status: Wrong Answer

Solution code:
L, N = map(int, raw_input().split())
if L > 100 or N < 0:
 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):
    answer+=x
print answer

Submission status: Wrong Answer

Solution code:
L, N = map(int, raw_input().split())
if L > 100 or N < 0:
 print 'error'
 exit()

input = []
for i in range(0, N):
 sentence = raw_input()
 if len(sentence) != L:
  print 'error'
  exit()
 input.append(sentence)

answer = ""
for x in sorted(input):
    answer+=x
print answer

Submission status: Wrong Answer

Solution code:
import sys

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

sorted(word)
for i in range(n):
  sys.stdout.write(word[i])

print()

Submission status: Wrong Answer

Solution code:
# coding: utf-8;

def main():
    alphabet = 'abcdefghijklmnopqrstuvwxyz'
    n, l = map(int, input().split())
    sl = [input() for _ in range(n)]
    d = {}
    for s in sl:
        ic = 0
        for i in range(l):
            ic += alphabet.find(s[i])
        d[s] = ic
    print(''.join([n[0] for n in sorted(d.items(), key=lambda x:x[1])]))


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

def string_sort(data, new_string):
    for i in range(len(data)):
        if data[i] > new_string:
            data.insert(i, new_string)
            return data
    data.insert(len(data)-1, new_string)
    return data


if __name__ == "__main__":
    N, L = map(int, input().split())
    data = []
    for _ in range(N):
        input_data = input()
        data = string_sort(data, input_data)
    print(''.join(data))

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    n,l = list(map(int,input().split()))
    a = [input() for _ in range(l)]
    a.sort()
    return ''.join(a)



print(main())

Submission status: Wrong Answer

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

print(s)
s.sort()
print(s)

for i in range(n):
    s[i] = "".join(s[i])
s = "".join(s)

print(s)

Submission status: Wrong Answer

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

s.sort()
print(s)

Submission status: Wrong Answer

Solution code:
N, L = map(int, raw_input().split())
S = [raw_input() for _ in xrange(N)]

# new_list = sorted(S, key=str.lower)
S.sort()

for n in S:
    print n

Submission status: Wrong Answer

Solution code:
N, L = map(int, raw_input().split())
S = [raw_input() for _ in xrange(N)]

new_list = sorted(S, key=str.lower)

for n in new_list:
    print n

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

N, L = map(int, raw_input().split())
print "".join(sorted(raw_input().split()))

Submission status: Wrong Answer

Solution code:
n,l = map(int,raw_input().split())
print n
var = []
while (n > 0):
    var.append(raw_input())
    n = n - 1
var.sort()
print ''.join(var)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(N-1):
    start = N - i - 1
    #print("start " + str(start))
    for j in range(start):
        #print(str(start-j-1) + " " + str(start-j))
        Left = String[start-j-1]
        Right = String[start-j]
        if Left > Right:
            String[start-j-1] = Right 
            String[start-j] = Left

for s in String:
    print(s, end="")

Submission status: Wrong Answer

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

for i in range(N-1):
    start = N - i - 1
    print("start " + str(start))
    for j in range(start):
        print(str(start-j-1) + " " + str(start-j))
        Left = String[start-j-1]
        Right = String[start-j]
        if Left > Right:
            String[start-j-1] = Right 
            String[start-j] = Left

for s in String:
    print(s, end="")

Submission status: Wrong Answer

Solution code:
N = int(input().split()[0])
words = [input().rstrip() for i in range(N)]
print(words)
print("".join(sorted(words)))

Submission status: Wrong Answer

Solution code:
n, l = map(int, raw_input().split())
s = [raw_input() for _ in xrange(n)]
gtable = [[] for _ in xrange(26)]
result = []

def searchPrint(e, n):
    table = [[] for _ in xrange(26)]
    for i in e:
        table[ord(s[i][n]) - 97].append(i)
        
    for el in table:
        if len(el) == 0:
            continue
        if len(el) == 1:
            result.append(s[el[0]])
            continue
        if n == l-1:
            for i in el:
                result.append(s[i])
            return
        searchPrint(el, n+1)
    
for i in xrange(n):
    gtable[ord(s[i][0]) - 97].append(i)
    
for e in gtable:
    if len(e) == 0:
        continue
    searchPrint(e, 1)
    
print "".join(result)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10000000)
n, l = map(int, raw_input().split())
s = [raw_input() for _ in xrange(n)]
gtable = [[] for _ in xrange(26)]
result = []

def searchPrint(e, n):
    table = [[] for _ in xrange(26)]
    for i in e:
        table[ord(s[i][n]) - 97].append(i)
        
    for el in table:
        if len(el) == 0:
            continue
        if len(el) == 1:
            result.append(s[el[0]])
            continue
        if n == l-1:
            for i in el:
                result.append(s[i])
            return
        searchPrint(el, n+1)
    
for i in xrange(l):
    gtable[ord(s[i][0]) - 97].append(i)
    
for e in gtable:
    if len(e) == 0:
        continue
    searchPrint(e, 1)
    
print "".join(result)

Submission status: Wrong Answer

Solution code:
n, l = map(int, raw_input().split())
s = [raw_input() for _ in xrange(n)]
gtable = [[] for _ in xrange(26)]
result = []

def searchPrint(e, n):
    table = [[] for _ in xrange(26)]
    for i in e:
        table[ord(s[i][n]) - 97].append(i)
        
    for el in table:
        if len(el) == 0:
            continue
        if len(el) == 1:
            result.append(s[el[0]])
            continue
        if n == l -1:
            for i in el:
                result.append(s[i])
            return
        searchPrint(el, n+1)
    
for i in xrange(l):
    gtable[ord(s[i][0]) - 97].append(i)
    
for e in gtable:
    if len(e) == 0:
        continue
    searchPrint(e, 1)
    
print "".join(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
ans = ""

def get_input():
    flag = 1
    cnt = 0
    while True:
        if flag == 1:
            N,L = input().split()
            flag = 0
            continue
        else:
            a = input()
            yield ''.join(a)
            cnt += 1
            if cnt >= int(N):
                break

if __name__ == "__main__":
    array = list(get_input())
    array.sort()
    print(array)

    for i in range(0,len(array)):
        ans += array[i]

    print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python2
#encoding: UTF-8

# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.
import math
line=raw_input().rstrip().split(' ')
N=int(line[0])
L=int(line[1])
listo=[]
for i in range(L):
    listo.append(raw_input().rstrip())
listi=sorted(listo)
listni=''
for i in range(L):
    listni+=listi[i]
print listni

Submission status: Wrong Answer

Solution code:
ans = ""

def get_input():
    flag = 1
    cnt = 0
    while True:
        try:
            if flag == 1:
                N,L = input().split()
                flag = 0
                continue
            else:
                a = input()
                yield ''.join(a)
                cnt += 1
                if cnt >= int(N):
                    break
        except EOFError:
            break

if __name__ == "__main__":
    array = list(get_input())
    array.sort()
    print(array)

    for i in range(0,len(array)):
        ans += array[i]

    print(ans)

Submission status: Wrong Answer

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

b = []
for i in range(N):
    n = 0
    for j in range(L):
        n = (n*27) + ord( a[i][j])-96
    b.append(n)
ind = b.index(max(b))
print('%s' % str(a[ind]))

Submission status: Wrong Answer

Solution code:
cond = [int(n) for n in input().split(" ")]
data = []
for a in range(cond[1]):
    data.append(input())
data = sorted(data)
print("".join(data))

Submission status: Time Limit Exceeded

Solution code:
memo = {}
def permutations(S):
    if len(S) == 1:
        return S
    res = []
    for i, s in enumerate(S):
        L = S[:i] + S[i+1:]
        k = ''.join(L)
        if k in memo:
            P = memo[k]
        else:
            P = permutations(L)
            memo[k] = P
        for p in P:
            res.append(f'{s}{p}')

    return res

if __name__ == '__main__':
    n, l = [int(x) for x in input().split(' ')]
    S = [input() for i in range(0, n)]
    print(min(permutations(S)))

Submission status: Time Limit Exceeded

Solution code:
def permutations(S):
    if len(S) == 1:
        return S
    res = []
    for i, s in enumerate(S):
        P = permutations(S[:i] + S[i+1:])
        for p in P:
            res.append(f'{s}{p}')
    return res

if __name__ == '__main__':
    n, l = [int(x) for x in input().split(' ')]
    S = [input() for i in range(0, n)]
    print(min(permutations(S)))

Submission status: Time Limit Exceeded

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

print(*sorted(p)[0], sep='')

Submission status: Time Limit Exceeded

Solution code:
import sys
from itertools import permutations


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, l = inintm()

s = []
z = []

for _ in range(n):
    s.append(input())

for i in permutations(s,n):
    t = ""
    for j in i:
        t += j
    z.append(t)

z.sort()

print(z[0])

Submission status: Time Limit Exceeded

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

while True:
    t = 0
    for i in range(N - 1):
        #print("i = {}".format(i))
        for j in range(L):
            #print("j = {}".format(j))
            if S[i+1][j] < S[i][j]:
                #print(S[i][j])
                temp = S[i+1]
                S[i+1] = S[i]
                S[i] = temp

                t = 1
                
    #print(S)
    if t == 0:
        break
        
print(''.join(S))

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations , combinations,combinations_with_replacement

n , l = map(int , input().split())
s = []
for _ in range(n):
    s.append(input())
p = permutations(s,n)
ss = []
for i in p:
    ss.append("".join(i))
ss.sort()
print(ss[0])

Submission status: Time Limit Exceeded

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

S = [0] * N

for i in range(N):
    S[i] = input()

from itertools import permutations, combinations,combinations_with_replacement,product

strings = [''.join(s) for s in list(permutations(S))]

strings.sort()
print(strings[0])

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations
n, l = map(int, input().split(' '))
lst = []
for _ in range(n):
  lst.append(input())
all_str = list(permutations(lst))
all_str = [''.join(x) for x in all_str]
print(min(all_str))

Submission status: Time Limit Exceeded

Solution code:
import itertools

NLinput = input()
NLinput = [int(x) for x in NLinput.split()]

N = NLinput[0]
L = NLinput[1]

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

perm = list(itertools.permutations(range(N)))
result = []
for i in perm:
    str_temp = ''
    for j in i:
        str_temp += S_list[j]
    result.append(str_temp)
result = sorted(result)
print(result[0])

Submission status: Time Limit Exceeded

Solution code:
# coding: utf-8
# Your code here!
import itertools

N,L= map(int,input().split())
S = [input() for i in range(N)]
ans= ""
for i in S:
    ans = ans+i 
for i in itertools.permutations(S):
    tmp = ""
    for j in i:
        tmp = tmp + j
    if tmp < ans:
        ans = tmp
print(ans)

Submission status: Time Limit Exceeded

Solution code:
x,y = map(int,input().split())
list = [input() for i in range(x)]
left = 0
right = x-1
for i in range(x):
    right = x-1
    while left < right:
        if list[right]<list[right-1]:
            escape = list[right]
            list[right] = list[right-1]
            list[right-1] = escape
        right-1
    left += 1
answer = ""
for lis in list:
    answer += lis
print(answer)

Submission status: Time Limit Exceeded

Solution code:
from itertools import permutations

n , l = input().split()
n = int(n)
l = int(l)
s = [input() for _ in range(n)]

p = list(permutations(s,n))
result = []
for i in p:
	ss = ''
	for n in i:
		ss += n
	result.append(ss)
result.sort()
print(result[0])

Submission status: Time Limit Exceeded

Solution code:
# n, lは最大100
# 計算量はn^2
# これであれば全探索いけるか
import itertools

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

candidates = []
index_candidates = list(itertools.permutations(range(len(s))))
for c in index_candidates:
  str = ""
  for index in c:
    str += s[index]
  candidates.append(str)

min_str = candidates[0]
for i in range(1, len(candidates)):
  for j in range(len(min_str)):
    if min_str[j] > candidates[i][j]:
      min_str = candidates[i]
      break
    elif min_str[j] < candidates[i][j]:
      break
print(min_str)

Submission status: Time Limit Exceeded

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

Submission status: Time Limit Exceeded

Solution code:
import itertools

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

s_marge = []
for v in itertools.permutations(s, n):
  s_marge.append(''.join(v))
  
d = sorted(s_marge)
print(d[0])

Submission status: Time Limit Exceeded

Solution code:
import itertools
N, L = map(int, input().split())
str_list = [input() for _ in range(N)]

tmp_str=''.join(['z' for _ in range(N*L)])
for ii in itertools.permutations(str_list):
    if tmp_str > ''.join(ii):
        tmp_str=''.join(ii)
        
print(tmp_str)

Submission status: Time Limit Exceeded

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

Submission status: Accepted

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

word = []
count = 0
while N > count:
    S = input()
    word.append(S)
    count += 1

word = sorted(word)
ans = ''.join(word)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
main = list(map(lambda x: int(x), input().split()))
n, l = main[0], main[1]
final = []
for i in range(n):
    string = input()
    final.append(string)

final.sort()
print(''.join(final))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(n):
  s = input()
  S.append(s)
  
S.sort()

ans = ''
for i in range(n):
  ans += S[i]
  
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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


print("".join(sorted(s)))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    n,l = map(int,input().split())
    words=[]
    words=[input().rstrip() for _ in range(n)]
    s_words=sorted(words,key=lambda x:x[0:])
    ans=""

    for s_word in s_words:
        ans+=s_word
    print(ans)
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
nl = list(map(int,input().split()))
N = nl[0]
L = nl[1]
ss = [input() for i in range(N)]
ss.sort()
res = ""
for i in ss:
  res = res+i
print(res)

Submission status: Accepted

Solution code:
_, _, *S = open(0).read().split()
print("".join(sorted(S)))

Submission status: Accepted

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

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

a.sort()

for i in range(N):
    print(a[i],end="")

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n,l = readInts()
lis = [input() for _ in range(n)]
lis = sorted(lis)
print(''.join(lis))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
sl = sorted(list(input() for _ in range(n)))

print(*sl, sep='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from typing import List


def answer(n: int, l: int, s: List[str]) -> str:
    return ''.join(sorted(s))


def main():
    n, l = map(int, input().split())
    s = [input() for _ in range(n)]
    print(answer(n, l, s))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,l = map(int,input().split())
s = [input() for _ in range(n)]
an = ''
for _ in range(n):
    an += min(s)
    s.remove(min(s))
print(an)

Submission status: Accepted

Solution code:
from collections import Counter
import math
import statistics
import itertools
a,b=map(int,input().split())
# b=input()
# c=[]
# for i in a:
#     c.append(int(i))
# A,B,C= map(int,input().split())
# f = list(map(int,input().split()))
#g = [list(map(lambda x: '{}'.format(x), list(input()))) for _ in range(a)]
# h = []
# for i in range(a):
#     h.append(list(map(int,input().split())))
# a = [[0] for _ in range(H)]#nizigen
lis=[input() for i in range(a)]
ra=a-1
for i in range(ra):
    for k in range(ra-i):
        if lis[k]>lis[k+1]:
            a=lis[k]
            lis[k]=lis[k+1]
            lis[k+1]=a
print("".join(lis))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from datetime import date

def main():
		
	line = input().split()
	n = int(line[0])
	k = int(line[1])


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

	ans = "";
	for x in sorted(a):
		ans += x

	print(ans)
	
main()

Submission status: Accepted

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

w.sort()

print("".join(w))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

sorted_list = sorted(text_list)

print(''.join(sorted_list))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    n, l = map(int, input().split())
    s = sorted([input() for i in range(n)])
    print("".join(s))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, L = map(int,input().split())
l = list()
for i in range(N):
	l.append(input())
print(*sorted(l),sep='')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N, L = map(int, input().split())
    Sn = [input() for i in range(N)]
    Sn2 = sorted(Sn)
    ans = ""
    for val in Sn2 :
        ans = ans + val
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

S = sorted(S)


print(''.join(S))

Submission status: Accepted

Solution code:
n,k=map(int,input().split())
w=[]
for i in range(n):
  w.append(input())
w.sort()
print(''.join(w))

Submission status: Accepted

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

print(''.join(sorted(S)))

Submission status: Accepted

Solution code:
# N、Lの入力受付
N, L = map(int, input().split())
# N回連続で入力文字列を受付
S = []
for i in range(N):
    S.append(input())
# S内をソート
S.sort()
# Sの要素を結合
result = ""
for i in range(N):
    result = result + S[i]
# resultを出力
print(result)

Submission status: Accepted

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

S_sorted = sorted(S)
Word = ''.join(S_sorted)

print(Word)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

S = [input() for _ in range(N)]
S.sort()

print("".join(S))

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
n,l = readInts()
S = sorted([input() for _ in range(n)])
print(''.join(S))

Submission status: Accepted

Solution code:
n, l = map(int, input().split())
sl = list(input() for _ in range(n))
sl_s = sorted(sl)

print(*sl_s, sep='')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

S.sort()
print("".join(S))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
l=[]
for i in range(a):
    a=input()
    l.append(a)
print("".join(map(str,sorted(l))))

Submission status: Accepted

Solution code:
N,L,*Ss =open(0).read().split()

ans = ""
for s in sorted(Ss):
  ans+=s
print(ans)

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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