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 Rust (1.15.1) (judge verdict: Accepted)

use std::io::stdin;
use std::io::Error;
use std::io::Read;

#[derive(Debug)]
struct Input {
    n: u32,
    k: u32,
    s: String,
}

fn handle_input(input_str: String) -> Result<Input, Error> {
    let mut iter = input_str.split_whitespace();
    let n: u32 = iter.next().unwrap().parse().unwrap();
    let k: u32 = iter.next().unwrap().parse().unwrap();
    let s = iter.next().unwrap();
    let input = Input {
        n: n,
        k: k,
        s: s.to_string(),
    };
    Ok(input)
}

fn handle_output(input: Input) -> Result<String, Error> {
    let mut iter = input.s.chars();
    let mut ret = String::new();
    for i in 0..input.s.len() {
        let c = iter.next().unwrap();
        if i == (input.k as usize - 1) {
            match c {
                'A' => ret.push('a'),
                'B' => ret.push('b'),
                'C' => ret.push('c'),
                _ => ret.push(' '),
            }
        } else {
            ret.push(c);
        }
    }
    Ok(ret)
}

fn main() {
    let mut input_str = String::new();
    stdin().read_to_string(&mut input_str).unwrap();
    let input = handle_input(input_str).unwrap();
    let output = handle_output(input).unwrap();
    println!("{}", output);
}