Menu
Coddy logo textTech

Anagrams

Lesson 23 of 32 in Coddy's Coding Problems course.

challenge icon

Challenge

Medium

For two numbers we say that they are anagrams if the digits of the first number can be rearranged, so that we get the second number. For ex. 123 is an anagram of 231, because they are the same digit in a different order. 

 

Write a program that gets a natural number N from input. In the next N lines you have two numbers, A and B. Output how many of those pairs of numbers are anagrams

 

Input
3
123 231
4567 6574
2345 2874

Output
2

Try it yourself

#include <stdio.h>

int main() {
    // Write code here
    return 0;
}

All lessons in Coding Problems