SHAKILKEYWORD - Keyword Finder
This is solution for shakilkeyword - keyword finder problem in spoj.The link for the the problem is
https://www.spoj.com/problems/SHAKILKEYWORD/
Note:
1)Be careful while printing the output there is blank line between output of each test case.
2)Understand the Delimiter Concept in this problem before solving it.
The CPP solution for SHAKILKEYWORD - Keyword Finder in spoj is.
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
using namespace std;
int main() {
int t;
long long ii,j,k,i;
string s;
cin>>t;
for(ii=0;ii<t;ii++)
{
getline(cin,s);
if(s.length()==0)
{
ii--;
continue;
}
string s1;
int flag=0;
long long count=0;
for(i=0;i<s.length();i++)
{
char c=s[i];
// cout<<c;
if((int)c==64||(int)c==33||(int)c==34||(int)c==94||(int)c==36||(int)c==38||(int)c==46||(int)c==44||(int)c==63||(int)c==124||(int)c==32||(int)c==42||(int)c==92)
{
if(flag==1)
{
cout<<s1<<endl<<endl;
count++;
}
s1="";
flag=0;
}
else
{
if(c=='#')
{
flag=1;
}
s1+=s[i];
}
}
if(flag==1)
{
cout<<s1<<endl<<endl;;
count++;
}
if(count==0)
{
cout<<"No keywords."<<endl<<endl;;
}
}
return 0;
}
Tags:
SHAKILKEYWORD - Keyword Finder Editorial or Solution SPOJ,SHAKILKEYWORD - Keyword Finder Editorial,SHAKILKEYWORD - Keyword Finder Solution SPOJ,SHAKILKEYWORD - Keyword Finder,SPOJ
No comments:
Post a comment