urgently needed a code in any programming language for the following question
Given a string S. Find a string R which is an anagram of S and the hamming distance between S and R is maximum.
An anagram of a string is another string that contains the same characters, only the order of characters can be different.
Hamming distance between two strings of equal length is the number of positions at which the corresponding character is different.
Input
The first and the only line of input contains a single string S.
Constraints:
1 <= |S| <= 100000
S contains only lowercase letters of the English alphabet.
Output
Print the maximum hamming distance between S and R.
Answers
Answered by
0
urgently needed a code in any programming language for the following question
Given a string S. Find a string R which is an anagram of S and the hamming distance between S and R is maximum.
An anagram of a string is another string that contains the same characters, only the order of characters can be different.
Hamming distance between two strings of equal length is the number of positions at which the corresponding character is different.
Input
The first and the only line of input contains a single string S.
Constraints:
1 <= |S| <= 100000
S contains only lowercase letters of the English alphabet.
Output
Print the maximum hamming distance between S and R.
Similar questions