Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- #include <string.h>
- int main()
- {
- char A[100010];
- scanf("%[^\n]", A);
- int n = strlen(A);
- int i = 0, j = n-1, c = 0;
- while (i < j) {
- if (!isalpha(A[i])) ++i;
- else if (!isalpha(A[j])) --j;
- else if (tolower(A[i]) != tolower(A[j])) {
- c = 0;
- break;
- }
- else ++i, --j, ++c;
- }
- if (c == 0) {
- printf("-\n");
- return 0;
- }
- for (int i = 0; c > 0; ++i) {
- if (isalpha(A[i])) {
- printf("%c", tolower(A[i]));
- --c;
- }
- }
- printf("\n");
- return 0;
- }
Add Comment
Please, Sign In to add comment