Pb1)
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char txt[256],*p;
int nr1=1,poz,nr2=0;
cin.getline(txt,256);
if(txt[0]=='a'||txt[0]=='e'||txt[0]=='i'||txt[0]=='o'||txt[0]=='u')nr2++;
p=strchr(txt,' ');
while(p!=NULL){
poz=p-txt;
strcpy(txt,txt+poz+1);
if(txt[0]=='a'||txt[0]=='e'||txt[0]=='i'||txt[0]=='o'||txt[0]=='u')nr2++;
nr1++;
p=strchr(txt,' ');
cout<<nr1<<" "<<nr2;
return 0;
}
Pb2)
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char txt[101],txtt[101],*p;
int nr=1,poz,i=1;
cin.getline(txt,256);
p=strchr(txt,' ');
txtt[0]=txt[0];
while(p!=NULL){
poz=p-txt;
strcpy(txt,txt+1+poz);
txtt[i]=txt[0];
i++;
nr++;
p=strchr(txt,' ');
}
cout<<txtt<<" "<<nr;
Pb3)
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char txt[101],txtt[101],*p;
int nr=1,poz,i=1;
cin.getline(txt,256);
p=strchr(txt,' ');
txtt[0]=txt[0];
while(p!=NULL){
poz=p-txt;
strcpy(txt,txt+1+poz);
txtt[i]=txt[0];
i++;
nr++;
p=strchr(txt,' ');
}
cout<<txtt<<" "<<nr;
Pb4)
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char txt[101],txtt[101],*p;
int poz,poz1=0,p1,p2,i,j=0,nr=0,nrmax=0;
cin.getline(txt,256);
p=strtok(txt," ");
while(p!=NULL){
nr=0;
poz=p-txt;
for(i=poz1;i<=poz;i++){
nr++;
}
if(nr>=nrmax){
nrmax=nr;
p1=poz1;
p2=poz;
}
poz1=poz;
p=strtok(NULL," ");
}
for(i=p1;i<=p2;i++){
txtt[j]=txt[i];
j++;
}
cout<<txtt;
return 0;
}
Pb5)
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char txt[100];
cin.getline(txt, 100);
char* x = strtok(txt, " ");
char* y = strtok(NULL, " ");
strcat(y, " ");
strcat(y, x);
strcpy(txt, y);
cout << txt;
return 0;
}