Advertisement
Guest User

CATYRICOIU

a guest
Oct 21st, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <fstream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. ifstream fin("palindrom.in");
  6. ofstream fout("palindrom.out");
  7.  
  8. int palindrom(char * s){
  9. for(int i=0, j=strlen(s)-1 ; i< j ; ++i, --j)
  10. if(s[i]!=s[j])
  11. return 0;
  12. return 1;
  13. }
  14.  
  15. int main(){
  16. int n;
  17. char s[25];
  18. fin >> n ;
  19. for (; n ; --n){
  20. fin >> s;
  21. fout << palindrom(s) << endl;
  22. }
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement