Problem: You are given a string S of length N consisting of `A`, `B` and `C`, and an integer K which is between 1 and N (inclusive). Print the string S after lowercasing the K-th character in it.

Submission attempts (in order):
def YorM(x):                                                                                                                                                        
        #1...YorM                                                                                                                                                   
        #0...Y                                                                                                                                                      
    if((1<=x)and(x<=12)):                                                                                                                                           
        return 1                                                                                                                                                    
    else:                                                                                                                                                           
        return 0                                                                                                                                                    
                                                                                                                                                                    
def D(a,b):                                                                                                                                                         
    n1 = YorM(a)                                                                                                                                                    
    n2 = YorM(b)                                                                                                                                                    
    #print(n1, n2)                                                                                                                                                  
    if(n1==0 and n2==0):                                                                                                                                            
        print("NA")                                                                                                                                                 
    elif(n1==0 and n2==1):                                                                                                                                          
        print("YYMM")                                                                                                                                               
    elif(n1==1 and n2==0):                                                                                                                                          
        print("MMYY")                                                                                                                                               
    else:                                                                                                                                                           
        print("AMBIGUOUS")                                                                                                                                          
                                                                                                                                                                    
                                                                                                                                                                    
S = input()                                                                                                                                                         
a = int(S[0:2])                                                                                                                                                     
b = int(S[2:4])                                                                                                                                                     
D(a, b) 

N = input().split()                                                             
N = [int(n) for n in N]                                                         
S = input()                                                                     
s = S.swapcase()                                                                
ans = str(S[0:N[1]-1] + s[N[1]-1] + S[N[1]:])                                   
print(ans)    

Verdicts: Wrong Answer

Accepted