#include<stdio.h> #include<string.h> int main() { char arr[] = "we are happy."; int i = 0; int j = 0; int len = 0; int count = 0; len = strlen(arr); for(i = 0;i < len;i++) { if(arr[i] == ' ') { count ++; } } i = len; j = 2 * count + len; while(i != j && i >= 0) { if(arr[i] == ' ') { arr[j--] = '0'; arr[j--] = '2'; arr[j--] = '%'; i--; } else { arr[j] = arr[i]; j--; i--; } } len = strlen(arr); for(i = 0; i< len ;i++) { printf("%c",arr[i]); } printf("\n"); return 0; }