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: Runtime Error)

use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
  let stdin = stdin();
  let stdin = stdin.lock();
  let token: String = stdin
    .bytes()
    .map(|c| c.expect("failed to read char") as char)
    .skip_while(|c| c.is_whitespace())
    .take_while(|c| !c.is_whitespace())
    .collect();
  token.parse().ok().expect("failed to parse token")
}

fn main() {
  let n = read::<usize>();
  let mut edges: Vec<(usize, usize, i32)> = vec![];
  let mut colors = vec![-1; n + 1];

  for _ in 0..n - 1 {
    let a = read::<usize>();
    let b = read::<usize>();
    let w = read::<i32>();
    edges.push((a, b, w))
  }
  for (a, b, i) in edges {
    if i % 2 == 0 {
      if colors[a] == -1 && colors[b] == -1 {
        colors[a] = 1;
        colors[b] = 1;
      } else if colors[a] != -1 {
        colors[b] = colors[a];
      } else if colors[b] != -1 {
        colors[a] = colors[b];
      }
    }
  }

  // index=0を削除
  colors.remove(0);

  for i in &mut colors {
    if *i == -1 {
      println!("{}", 0);
    }
    println!("{}", *i);
  }
}