Submit | All submissions | Best solutions | Back to list |
Problem hidden
AUS - COMCHARS |
"It is the working man who is the happy man. It is the idle man who is the miserable man. "
Hence, one day, three friends, anshul , utkarsh and shubham, sitting idle, decided to play a game of finding common characters along with their frequency in their randomly written strings. To make the conditions worse, they inlcuded special characters and numbers apart from alphabets in their large strings. Finding it difficut to do the task with these "extra complicated" strings, they want you to write a program, to calculate the common characters in their string and their frequency of occurence.
If there are common characters, you need to print the character along with its frequency.
In case no character is common, you are required to print "NO CHARACTER COMMON."
Input
First line of input contains number of test cases N ( N<=1000000 )
Each test case consists of three strings.
Each of the three lines of a test case contains a string of size L (L<10^6).
Output
First line of output contains case number ( Case_n_:) (underscore denotes space)
In the next subsequent lines, print the character and its frequency , sepreated by a space , in case common character exists, else print "NO CHARACTER COMMON."
Leave a line after each testcase output's.
Example
Input:
2 ANSHUL UTKARSH SHUBHaM 474015 ABV-IIITM &%(*Q(#*%
Output :
Case 1 : H 1 S 1 U 1 Case 2 : NO CHARACTER COMMON.
Added by: | Vars |
Date: | 2015-09-23 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | own |