Submit | All submissions | Best solutions | Back to list |
Problem hidden
KHALED - Friend numbers |
Ahmed and Mohamed love friends numbers – they say number x is friend to number y if and only if X contains number of digits equal to number of digits in Y. ex : 123 is friend to 457 , 1000 is friend to 9999 But 789 is NOT friend with 10 .
Ahmed and Mohamed decide to play a game, they choose randomly 2 friend numbers and count the number of different digits.
Ex: 1) 123 and 457 are different in 3 digits (because (1) is not the same to its corresponding digit (4) , (2) is not same to its corresponding digit (5) … and so on .
Ex: 2) 123, 145 are different in 2 digits. Given 2 friend numbers count the number of differences between their digits.
Input
Two space-separated friend numbers X and Y, (0<=X, Y<=1000000000)
Output
The number of different corresponding digits.
Example
Input:
10000 15678
Output:
4
Added by: | Hossam El-Deen Goodname |
Date: | 2012-10-13 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | Khaled Samy |