Problem:
Score : 100 points

Problem Statement

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.

Constraints

1 ≤ N ≤ 50

1 ≤ K ≤ N

S is a string of length N consisting of A, B and C.

Input

Input is given from Standard Input in the following format:

N K
S

Output

Print the string S after lowercasing the K-th character in it.

Sample Input 1

3 1
ABC

Sample Output 1

aBC

Sample Input 2

4 3
CABA

Sample Output 2

CAbA

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Accepted)

import java.util.Scanner;
import java.util.InputMismatchException;

class Main {
   public static void main(String args[]) {
      int x=0 ,y=0;
      int sum = 0;
      String s;
      Scanner scanner = new Scanner(System.in);
      x = scanner.nextInt();
      y = scanner.nextInt();
      s = scanner.next();
      scanner.close();

      String s1 = null;
      if (y-1>-1) {
         s1 = s.substring(0,y-1);
      }
      char s4 = s.charAt(y-1);
      String s3 = null;
      if (y<s.length()) {
         s3 = s.substring(y,s.length());
      }
      String s2 = String.valueOf(s4);
      s2 = s2.toLowerCase();
      if (s1 != null && s3 != null) {
         System.out.println(s1 + s2 + s3);
      } else if (s1 != null) {
         System.out.println(s1 + s2);
      } else if (s3 != null) {
         System.out.println(s2 + s3);
      } else{
         System.out.println(s2);
      }
   }
}