You are given a string str. It costs one unit of a coin to change a character at an index. Your task is to convert it into a palindrome with minimum coins. Also, you are given q number of queries. The queries are of the following types:
After solving the first type of query, you can convert character A into character B without any cost and vice versa. In the second type of query, you are required to answer the minimum cost that is required to convert the given string into a palindrome.
Note: If character A can be converted to character B and character B can be converted to character C, then you can convert character A to character C.
Input format
Output format
For each query of type 2, print the minimum cost to convert a given string into a palindrome.
Constraints
1≤n≤105
1≤q≤105
The string consists of only lowercase letters.
After the first query, a can be converted to b.
In the second query, all the pairs cost 1 unit for making the palindrome.
After the third query, w can be converted into z or vice-versa with zero cost.
In the fourth query, since z can be converted to w in 0 cost, total cost is equal to 4.