Nathan is a Researcher in English Literature. According to him string which when split in the middle, gives two halves having the same characters and the same frequency of each character is termed as Lapindrome.
If there are an odd number of characters in the string, the middle character needs to be ignored and to be checked for lapindrome. can you find the lapindrome strings?
Input:
The first integer T, the number of test cases.
Each testcase is a single line containing a string of only lowercase English alphabet.
Output:
If the string is a lapindrome print "YES" otherwise print "NO".
#include <stdio.h> #include<string.h> int main() { int i=0,T=0; scanf("%d",&T); for(i=0;i<T;i++){ int arr1[26],arr2[26]; memset(arr1,0,26*sizeof(int)); memset(arr2,0,26*sizeof(int)); char S[20];scanf("%s",S); int j=0,k=strlen(S)-1,flag=0; while(j<k){ arr1[S[j]-'a']++; arr2[S[k]-'a']++; j++; k--; } for (j=0;j<26;j++){ if(arr1[j]!=arr2[j]){printf("NO\n");flag=1;break;} } if(flag==0){printf("YES\n");} } return 0; }
INPUT_!:
6
gaga
abcde
rotor
xyzxy
abbaab
ababc
OUTPUT:
YES
NO
YES
YES
NO
NO
INPUT_2:
5
ghfgh
malayalam
gogo
roor
caffac
OUTPUT:
YES
YES
YES
YES
YES
ILLUSTRATION – THE REAL OUTPUT DISPLAY
![](http://www.fcukthecode.com/wp-content/uploads/2022/01/Screenshot-from-2022-01-02-16-11-44.png)
Morae Q!
- Conversion of days into year, weeks and days.
- Find if the number is a perfect number or not.
- Compute conversion of Binary to Octal.
- Return the sum of digits in a number.
- Find if a word exists or not in a sentence.
- Convert Numbers into Words.
- Read a word if it consists only of the letters known.
- Check if the string is a dynamic string or not.
- Convert all Uppercase letters to Lowercase and vice-versa.
- Change the string such that there are no matching adjacent characters.
- Find the number of sub-strings which start and end both in 1.
- Find the start and end index of unsorted sub-array.
- Find the maximum number of pairs that can be formed.
- Figure out the number of bubbly words present.
- Check if a string is lapindrome or not even with a middle character.
- Seating layout in a triangular shaped class according to the number of rows.
- Find and Sort a sub-array which makes whole array sorted.
- Seating layout according to the number of rows.
- Find the final states of the bulbs.
- Check if reversing sub array makes the array sorted.