Translate

Views

Tuesday, July 30, 2019

Solution Kattis · Simon Says

https://open.kattis.com/problems/simonsays
#include<bits/stdc++.h>
using namespace std;

int T;
string s,x;

int main(){ 
ios_base::sync_with_stdio(false); 
cin.tie(NULL); cout.tie(NULL);
 
 cin >> T; getline(cin, s);
 while(T--){ x="";
 
  getline(cin, s);
 
  for(int i=0; i<10; i++) x+=s[i];
 
  if (x=="Simon says"){
   s.erase(0, 10);
   cout<<s<<"\n";
  }  
 }
}
Good luck! If you need help please leave a comment :) 

No comments: