# A. Digits Sequence (Easy Edition) Codeforces

A. Digits Sequence (Easy Edition)

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Let's write all the positive integer numbers one after another from $1$ without any delimiters (i.e. as a single string). It will be the infinite sequence starting with 123456789101112131415161718192021222324252627282930313233343536...

Your task is to print the $k$-th digit of this sequence.

Input

The first and only line contains integer $k$ ($1\le k\le 10000$) — the position to process ($1$-based index).

Output

Print the $k$-th digit of the resulting infinite sequence.

Examples
input
Copy
7

output
Copy
7

input
Copy
21

output
Copy
5

### Solution

Explanation-
In the above question, we have to find the kth digit when all numbers are written in a string without spaces. So for this we will simply make a vector and we will add all the numbers to it by converting current number into string, and then simply find the k-1th number in the vector.

#include<bits/stdc++.h>using namespace std; #define vv vector<int> v;     int main(){    #ifndef ONLINE_JUDGE    // for getting input from input.txt    freopen("input.txt", "r", stdin);    // for writing output to output.txt    freopen("output.txt", "w", stdout);#endif      //taking the input k    int k;    cin>>k;//making a vector to store all the digits into char form    vector<char>v;// t for converting the t into string and then storing all the digits in vector    int t=1;//making start so that we can count the lenght of current number (t)    int start=0;    for(int i=0; i<k; i++){        string s=to_string(t);        start=0;        while(start<s.length()){            v.push_back(s[start]);            // cout<<s[start]<<" ";            start++;        }        t++;    }    cout<<v[k-1];    return 0; }