Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- printf("Unesite string: ");
- char s[100+1];
- scanf("%[^\n]100s", s);
- char* pok = s;
- while(*pok!='\0'){
- if(*pok==' ' && *(pok+1)==' '){
- char* ppok = pok;
- while(*ppok!='\0'){
- *ppok = *(ppok+1);
- ppok++;
- }
- }
- else pok++;
- }
- pok = s;
- while(*pok!='\0'){
- if(isalpha(*pok) && *pok!=' '){
- int brojac = 0;
- char* ppok = pok+1;
- while(*ppok!=' ' && *ppok!='\0' && isalpha(*ppok)){
- brojac++;
- ppok++;
- }
- char pomocniString[brojac+1];
- for(int i=0;i<brojac+1;i++)pomocniString[i] = *(pok+i);
- ppok = pok;
- for(int i=brojac;i>=0;i--){
- *ppok = pomocniString[i];
- ppok++;
- }
- pok = pok+brojac;
- }
- pok++;
- }
- printf("Novi string je: %s\n",s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement