Password Change
InterviewTime limit2sMemory limit512 MB
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 letters of the password must be the same as the last 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 , 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 .
The second line contains a positive integer . 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.