Problem Name: Rotating Sentences
Problem Source: Uva Online Judge
Problem No: 490
Problem Difficulty: Easy
Problem Difficulty: Easy
Problem Link: Here
Submit Solution Here
Important Point
- You must have to assign a white space to every null value of every sentence.
- Top sentence will be on right most and last sentence will be on left most.
- You have to print every character including white space.
Source Code
#include<bits/stdc++.h>
using namespace std;
//Code Written by Al Shah Reyaj
//BSMRSTU, Gopalganj, Bangladesh
int main()
{
char s[105][105];
int c=0,m=0,l;
for(int i=0;i<105;i++)
{
for(int j=0;j<105;j++) s[i][j]=' ';
}
while(gets(s[c]))
{
l=strlen(s[c]);
if(l>m) m=l;
c++;
}
for(int i=0;i<m;i++)
{
for(int j=c-1;j>=0;--j)
{
if(s[j][i]=='\0') cout<<' ';
else
cout<<s[j][i];
}
cout<<endl;
}
return 0;
}
Thanks for Reading This. Check our more Activities.
EmoticonEmoticon