Ff_c109 @ 2021-05-15 09:01:36
#include <iostream>
#include <string.h>
using namespace std;
int main() {
string a;
cin >> a;
int d;
cin >> d;
int length;
length = a.length();
char temp;
while(1) {
if(d <= length) {
cout << a[d - 1];
return 0;
}
else {
temp = a[length-1];
a += temp;
a += a.substr(0, length-1);
length *= 2;
}
}
}