Forgot Password ?
New password will be sent to following email id
Problem Code : FSTRING1
4 a 3 b 2 c 2 d 1
Time Limit :
C , C++ , Java , Python 2
Login to submit your response.
Chotu like strings so much. One day when he was on his walk of enlightenment, he found a magical door. But instead of a normal key, there was a string lying there. Along with the string lies a note, which said, if chotu can give the door the <b>list of all characters</b> in the string, along with their <b>frequency</b>, in the <b>decreasing order</b> of frequency count, he shall be allowed to pass through the gate and contiue his walk of enlightenment.<br> As chotu is in hurry, he asks you, his best friend for help. Help him open the door.
Input consists of a single string <b>S</b>, the magical string that chotu found.
In the first line, print <b>X</b>, denoting number of characters in the given String.<br> Next <b>X</b> line contains <b>C</b> and <b>N</b>, denoting the character, and its respective number of occurance in the string.
1 ≤ <b>|S| </b> ≤ 100000<br/> The string consists of lowercase english alphabets only.<br> If two charactes have same frequency, print <a href = "https://en.wikipedia.org/wiki/Lexicographical_order" target='_blank' >lexicographically smaller</a> character first.