24 lines
509 B
C
24 lines
509 B
C
|
// vim: set ts=4 sw=4 et tw=80:
|
||
|
|
||
|
#include <stdio.h>
|
||
|
#include <string.h>
|
||
|
#include <stdbool.h>
|
||
|
|
||
|
bool compare_reverse(char* s1, char* s2) {
|
||
|
const size_t len = strlen(s1);
|
||
|
if (len != strlen(s2))
|
||
|
return false;
|
||
|
for (size_t i = 0; i < len; i++)
|
||
|
if (s1[i] != s2[len - 1 - i])
|
||
|
return false;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
int main (const int argc, char** argv) {
|
||
|
for (int i = 1; i < argc - 1; i++)
|
||
|
for (int j = i + 1; j < argc; j++)
|
||
|
if (compare_reverse(argv[i], argv[j]))
|
||
|
printf("%s %s\n", argv[i], argv[j]);
|
||
|
}
|