Head vs breakz

[code] - 백준 문자열 11654,11720,10809,2675,1157,1152,2908,5622,2941,1316번 python 본문

Head/Code

[code] - 백준 문자열 11654,11720,10809,2675,1157,1152,2908,5622,2941,1316번 python

headbreakz 2020. 4. 4. 16:28

11654

#문자열
#11654
a = input()
print(ord(a))

11720

#11720
a = int(input())
b = list(str(input()))
e = 0
for i in range(a):
    d = int(b[i])
    e += d  
print(e)

10809

#10809
a = list(str(input()))
b = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
c = [-1 for j in range(len(b))]

for i in range(len(a)):
    if c[b.index(a[i])] == -1 :
        c[b.index(a[i])] = i
for i in range(len(c)):
    print(c[i],end = " ")

    

2675

#2675
a = int(input())

for i in range(a):
    b = list(map(str,input().split()))
    c = list(b[1])
    d = ''
    for j in range(len(c)):
        d += c[j]*int(b[0])
    print(d)         

1157

#1157
a = str(input())
b = list(a.upper())
c = list(set(b))
d = []

if len(b) == 1 :
    print(a.upper())
    
else :

    for i in range(len(c)):
        d.append(b.count(c[i]))
    e = sorted(d)
    if e[len(c)-1] == e[len(c)-2] :
        print("?")
    else :
        print(c[d.index(max(d))])

    

1152

#1152
a = list(input().split())
print(len(a))

2908

#2908
a =list(map(int,input().split()))

c = ((a[0]%10)*100)+(((a[0]%100)-(a[0]%10)))+(a[0]//100)
d = ((a[1]%10)*100)+(((a[1]%100)-(a[1]%10)))+(a[1]//100)

if c > d :
    print(c)
elif c < d :
    print(d)

5622

#5622
a = list(str(input()))
b = 0
for i in range(len(a)):
    if a[i] =='A' or a[i] == 'B' or a[i] == 'C':
        b +=2
    elif a[i] =='D' or a[i] == 'E' or a[i] == 'F':
        b +=3
    elif a[i] =='G' or a[i] == 'H' or a[i] == 'I':
        b +=4
    elif a[i] =='J' or a[i] == 'K' or a[i] == 'L':
        b +=5
    elif a[i] =='N' or a[i] == 'M' or a[i] == 'O':
        b +=6
    elif a[i] =='P' or a[i] == 'Q' or a[i] == 'R' or a[i] =='S':
        b +=7
    elif a[i] =='T' or a[i] == 'U' or a[i] == 'V':
        b +=8
    elif a[i] =='W' or a[i] == 'X' or a[i] == 'Y' or a[i] =='Z':
        b +=9
print(b+len(a))

2941

#2941

a = input()

b = ['c=','c-','dz=','d-','lj','nj','s=','z=']

for i in b :
    a = a.replace(i,'*')
    
print(len(a))
#1316

a = int(input())
count = 0
for i in range(a):
    b = list(str(input()))
    c = []
    c.append(b[0])
    if len(b) == 1 :
            pass
            
    else :
        for j in range(len(b)-1):
            if b[j] != b[j+1] :
                c.append(b[j+1])
                
    if len(c) == len(set(c)):
        count+=1

print(count)
        

    

 

Comments