fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string s;
  10. size_t n;
  11.  
  12. cin >> s;
  13.  
  14. for (n=2; n<s.length() && !equal(s.begin(), s.begin()+n-1, s.rend()-n); ++n);
  15. n >>= 1;
  16.  
  17. for (size_t q=n+1, w=0; q<s.length(); ++q, ++w%=n)
  18. cout << s[q] << ' ' << s[w] << endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 15240KB
stdin
PassssaPandsometext
stdout
s P
a a
P s
a s
n P
d a
s s
o s
m P
e a
t s
e s
x P
t a