Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bits/stdc++.h"
- using namespace std;
- bool isTimestamp(string S){
- bool numOnly=true;
- for(char x:S)
- if(x<'0' || x>'9')
- if(x!=':')
- numOnly=false;
- return S.find(":") != string::npos && numOnly;
- }
- void solve(){
- while(true){
- string line;
- getline(cin,line);
- if(isTimestamp(line)){
- string videoTime = line;
- getline(cin,line);//"NOW PLAYING"
- getline(cin,line);
- string videoTitle = "\"" + line + "\"";
- getline(cin,line);
- string videoCreator = "\"" + line + "\"";
- cout << videoTime << "," << videoTitle << "," << videoCreator << '\n';
- }
- else if(line.size()){
- string videoTitle = "\"" + line + "\"";
- getline(cin,line);
- string videoCreator = "\"" + line + "\"";
- cout << "" << "," << videoTitle << "," << videoCreator << '\n';
- }
- }
- }
- int main(){
- freopen("tmp.in","r",stdin);
- freopen("tmp.out","w",stdout);
- solve();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement