Showing posts with the label CodeforcesShow all

def A_Word ( string ) : lo = '' up = '' for ch in string : if ch == ch. lower () : lo += ch else : up += ch if len (lo) == len (up) : print ( string …

def Translation ( string_1 , string_2 ) : reverse = string_2 [ ::- 1 ] if string_1 == reverse : print ( 'YES' ) else : print ( "NO" ) if __name__ == '__main__' : for _ in …

def Anton_and_Danik ( string ) : A = '' D = '' for ch in string : if ch == 'A' : A += ch else : D += ch if len (A) == len (D) : print ( '…

def Solve ( a , b ) : count = 0 while a <= b : a *= 3 b *= 2 count += 1 print (count) if __name__ == '__main__' : a, b = map ( int , input (). split ()) Solve (a, b)

def Word_Capitalization ( test_str ) : res = test_str [ 0 ]. upper () + test_str [ 1 : ] print (res) if __name__ == '__main__' : test_str = input () Word_Capitalization (test_str)

a = input (). lower () b = input (). lower () if a == b : print ( 0 ) elif a > b : print ( 1 ) elif a < b : print ( - 1 )

a = input () res = '' for i in range ( 0 , len (a) + 1 , 2 ) : res += a[i] print ( * sorted (res), sep = '+' )

def Boy_or_Girl ( string ) : s_sort = set ( string ) if len (s_sort) % 2 == 0 : print ( 'CHAT WITH HER!' ) else : print ( 'IGNORE HIM!' ) if __name__ == '__main__' : string …

for _ in range ( int ( input ())) : s = input () f_s = s[ 0 ] l_s = s[ - 1 : ] if len (s) <= 10 : print (s) else : print ( '%s%d%s' % (f_s, ( len (s) - 2 ),l_s))

w = int ( input ()) if w % 2 == 0 and w != 2 : print ( "YES" ) else : print ( "NO" )

def Team ( a , b , c ) : res = ( a + b + c ) if res > 1 : return res if __name__ == '__main__' : n = int ( input ()) problem_sove_count = 0 for _ in range ( 1 , n + 1 ) : a, b , c = …

class Solution : def Next_Round ( self , k , arr ) : kth_place = arr [ k - 1 ] count_next_round = 0 for i in range ( len ( arr )) : if arr [i] > 0 : if arr [i] >= kth_…

def Domino_piling ( M , N ) : board_size = M * N pieces = 2 * 1 maximal_number_of_dominoes = board_size // pieces print (maximal_number_of_dominoes) if __name__ == '__main__' : M, N = map ( int , input…

increases = 0 decreases = 0 for _ in range ( int ( input ())) : s = input () if s == 'X++' or s == '++X' : increases += 1 elif s == '--X' or s == 'X--' : decreases += 1…