Ya it is possible,
i can only give you the logic,
First take a char array of size 26 i.e.a char for each alphabet
initialize it with null or any other symbol..
then check ur 1st string(i.e in ur example ABBABCAC)
when first A is encountered store its corresponding value i.e K in array
when first B is encountered store its corresponding value i.e X in array
do d same till Z.
it will just need a for loop, starting from 65 to 97(Ascii value of A-Z)
then create a string with this corresponding array
i.e. check ascii value of 1 st char i.e 65 put array[0] for it..etc..
check whether this string is equal to entered string(KXXKXPKP)
if still problem exist plz contact me dipen.thakkar@ymail.com