Problem Solving Ideas:
1. Transpose the string
2. Transpose the words in the transpose string
1#include <stdio.h>2#include <string.h>3#include <stdlib.h>4#include <stdbool.h>5 //String Transpose6 voidTRANSTR (Const Char*p,Char*s)7 {8 intLen =strlen (p);9 inti,j;Ten for(i=len,j=0; i>=0,j<len; I--, J + +) One { A* (S+J) = * (p+i-1); - } -* (S+J) =' /'; the } - - //determine if it is a letter - BOOLIschar (Charc) + { - BOOLIsC =false; + if(c >='a'&& c<='Z') A|| (c>='A'&&c<='Z')) atIsC =true; - returnIsC; - } - //Transpose Words - voidTranword (Char*a,intcount) - { in inti; - Chartemp; to for(i=0; i<count/2; i++) + { -temp = * (a+count-1-i); the* (a+count-1-i) = * (A +i); ** (a+i) =temp; $ }Panax Notoginseng } - the //Transpose the words in the transpose string + voidTranstrword (Char*a) A { the intI=0, count=0, Len; + for(i=0; i<len; i++) - { $ if(Ischar (* (A +i))) $count++; - Else - { theTranword (a+i-count,count); -Count =0;Wuyi } the if(count>0&& i==len-1) - { WuTranword (a+i-count+1, count); - } About } $ } - - intMainvoid) - { A Chararr[ -],brr[ -]; +scanf"%[^\n]", arr); //Enter the end of the carriage return to receive whitespace the transtr (ARR,BRR); - Transtrword (BRR); $ puts (BRR); the return 0; the}
C Transpose string cheap man->man cheap So A is you