Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Cod afisare inversa sir de caractere
- #include <iostream>
- #include <cstring>
- using namespace std;
- char s[101],t[101],*p;
- int lgmax,n,b,i,j,f,l;
- int main()
- {
- cin.getline(s,101);
- strcpy(t,s);
- p=strtok(t+1,"#");
- while(p)
- {
- l=strlen(p);
- if(l>lgmax) lgmax=l;
- p=strtok(NULL,"#");
- }
- p=strtok(s+1,"#");
- while(p)
- {
- l=strlen(p);
- if(l>lgmax)
- cout<<p<<"#";
- else
- {
- //ac
- for(i=l-1;i>=0;i--)
- cout<<p[i];
- cout<<"#";
- }
- p=strtok(NULL,"#");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement