Dyslexia
Time limit1sMemory limit128 MB
Compare two equal-length strings character by character and count positions where the letters match exactly, including case.
- Level
Easy1 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem
In recent years the children in Byteland have been reading almost no books. This has a negative influence on the knowledge of orthography (spelling) among Byteland residents. Teachers do their best to change the situation, organizing many tests and contests to raise pupils' spelling skills, yet things hardly improve. Many children hold a dyslexia certificate, which lets them ignore the spelling mistakes they make. The Ministry of Education decided to act. From now on, every holder of a dyslexia certificate must prove that he or she really is dyslexic. Because so many children in Byteland are affected, the validation process has to be automated. Every child rewrites a special set of texts on a computer, and the number of correctly rewritten letters decides whether the pupil is dyslexic. The Ministry of Education asks you to write the validating program.
Write a program that:
- reads two texts from standard input, the original one and the version rewritten by a pupil,
- determines how many letters were rewritten correctly,
- writes the result to standard output.
A letter is counted as rewritten correctly when it is identical, letter case included, to the letter at the same position in the original text.
Input
The first line contains one integer (), the length of the original text, which is also the length of the rewritten text. The second line contains the original text. The third line contains the text rewritten by the pupil. Each text consists of exactly lowercase and/or uppercase letters of the English alphabet.
Output
Output one non-negative integer: the number of letters that were rewritten correctly.