fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. string isPalindrome(string word,bool print){
  6. print = false;
  7. if(word.length() < 2) {
  8. print = true;
  9. if (print==1)
  10. cout << "YES" << endl;
  11. else
  12. cout << "NO" << endl;
  13. }else if(word[0] == word[word.length() - 1]){
  14. return isPalindrome(word.substr(1, word.length() - 2),print);
  15. }
  16.  
  17.  
  18. if (print==1)
  19. cout << "YES" << endl;
  20. else
  21. cout << "NO" << endl;
  22.  
  23. }
  24.  
  25.  
  26. int main()
  27. {
  28. string a;
  29. bool b;
  30.  
  31. cin >> a;
  32.  
  33. cout << isPalindrome(a,b);
  34.  
  35. /*if (isPalindrome(a,b)==1)
  36. cout << "ITS A PALINDROME :)" << endl;
  37. else
  38. cout << "ITS NOT:(" << endl;
  39. */
  40.  
  41.  
  42.  
  43. return 0;
  44. }
Runtime error #stdin #stdout 0s 3148KB
stdin
Standard input is empty
stdout
YES
YES
��9�u߃�[^_]��
���������������S���������[�YESbasic_string::substrNO%s: __pos (which is %zu) > this->size() (which is %zu);H,���d\���(\���p|����������������������zR|� ����0FJtx?;*2$"@|���0T���9A�HU
A�ALAAA HzPLR|`��4$���F@�A�B
F����
�A�A�A�Jq.D\,����U�DGuEutu|uxS.c
�A�A�A�CA$(��(CE HEEE H8P|���aA�A�C�A�N0HA�A�A�A��������)�������#�>�Q��������s}�X�
�p�x����o����́
3���ȇ�� ���o�����o�o����������ƈֈ�����&�6�F�V�f�v�������GCC: (Debian 4.9.2-10) 4.9.2GCC: (Debian 4.8.3-13) 4.8.3.shstrtab.interp.note.ABI-tag.note.gnu.build-id.gnu.hash.dynsym.dynstr.gnu.version.gnu.version_r.rel.dyn.rel.plt.init.text.fini.rodata.eh_frame_hdr.eh_frame.gcc_except_table.init_array.fini_array.jcr.dynamic.got.got.plt.data.bss.comment4�4H�H !h�h$4���o���@>́��F���3N���o���8[���o����j	��� s	Bȇ��|X�X#w���0����	2�������\�T�TL������@�@-�p�p�x�x�|�|������������T�آ����d@�0�:A�HU
A�ALAAA HzPLR|`��4$���F@�A�B
F����
�A�A�A�Jq.D\,����U�DGuEutu|uxS.c
�A�A�A�CA$(��(CE HEEE H8P|���aA�A�C�A�N0HA�A�A�A��������)�������#�>�Q��������s}�X�
�p�x����o����́
3Y�����ȇ�� ���o�����o�o����0Y����0NT�����ƈ�2t�`<t�0�R���y��&� �t�F���v�f�v��v�����v��}��}�,��}����}���}�X�}�`�}�L}�`}���}� �}���}�X�}�`�}�