1 #include <iostream> 2 using namespace std; 3 4 void substring(char* str) 5 { 6 int len = strlen(str); 7 len = 2*len + 1; 8 for(int i = len; i >= 1; i--) 9 { 10 if(i%2 == 0) 11 str[i-1] = str[i/2-1]; 12 else 13 str[i-1] = '#'; 14 } 15 str[len] = '