help!!!

P3612 [USACO17JAN] Secret Cow Code S

chenjieyang @ 2022-10-01 16:50:44

//P3612 [USACO17JAN]Secret Cow Code S
#include<iostream>
#include<string>
#include<cstring>
#include<iomanip>
#include<algorithm>
#include<cmath>
#define ll long long
using namespace std;
string s;
ll n,len;
int main(){
    cin>>s>>n;
    len=s.size();
    while(len<n){
        len=s.size();
        string s1=s;
        s1=s1[0]+s1;
        s1=s1.substr(0,len);
        s+=s1;
    }
    cout<<s[n-1];
    return 0;
}

|