subtask 1 and one test case of subtask 2 running for art of balance question??

can anybody help with my code I was not able to debug it although my logic seems correct.
link to my code:>>

https://ideone.com/e.js/HiAdKh

if(nfact > 26)continue; (line 28)

Remove this line of code and you’ll get an AC as number of times a letter is present can be greater than 26.