Skip to main content

Posts

Team Name codechef February 2021 long challenge editorial Full solution with code

 Team Name codechef  February 2021  long challenge editorial Full solution with code- Problem Statement- –°hef has assembled a football team! Now he needs to choose a name for his team. There are  N N  words in English that Chef considers  funny . These words are  s 1 , s 2 , … , s N s 1 , s 2 , … , s N . Chef thinks that a good team name should consist of two words such that they are not funny, but if we swap the first letters in them, the resulting words are funny. Note that under the given constraints, this means that a word is a non-empty string containing only lowercase English letters. Can you tell Chef how many good team names there are? Input The first line of the input contains a single integer  T T  denoting the number of test cases. The description of  T T  test cases follows. The first line of each test case contains a single integer  N N . The second line contains  N N  space-separated strings  s 1 , s 2 , … , s N s 1 , s 2 , … , s N . Output For each test case, print a