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: Wrong Answer)

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);	
		
		int n = sc.nextInt();
		int k = sc.nextInt();
		int len = k/n;
		double sum = 0;
		if(n > k) {
			for(int i=1; i<=(k/2)+1; i++) {
				sum += 1/(n * Math.pow(2, i+1));
			}
			System.out.println(sum + (double)(n-k)/n);
			return;
		}else {
			for(int i=1; i<=len; i++) {
				sum += 1/(n * Math.pow(2, i+1));
			}
		}
		
		System.out.println(sum);
	}
}