time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered…