Under construction

Still being built. Things may change

Password Change

Interview

Time limit2sMemory limit512 MB

Summary
Find the minimum letter changes so the first K characters equal the last K characters.
Level

Easy3 of 10

Topics
String, Implementation
Solved
No attempts yet

Problem

A web service introduced a new password rule, and Yeongseon wants to update her password to satisfy it.

The rule is a single condition. The first KK letters of the password must be the same as the last KK letters.

The length of the password stays the same, and the letter at any position may be replaced with another lowercase letter. Given Yeongseon's old password and KK, write a program that finds the minimum number of letters that must be changed to satisfy the new rule.

Input

The first line contains the old password. It consists of lowercase letters only, and its length is at most 5050.

The second line contains a positive integer KK. KK is at most the length of the old password.

Output

Print the minimum number of letters that must be changed to satisfy the new rule.

Examples4

  1. Example 1

    Input
    abcabc
    3
    
    Expected output
    0
    
  2. Example 2

    Input
    loool
    3
    
    Expected output
    1
    
  3. Example 3

    Input
    abcdefgh
    8
    
    Expected output
    0
    
  4. Example 4

    Input
    amavckdkz
    7
    
    Expected output
    5