Please tell me what is wrong in my approach.
#include <iostream>
#include <string>
using namespace std;
string datatype(string x) {
    for (int k = 0; k < strlen(x.c_str());) {
        for (int i = 0; i < 10; i++) {
            char z = i;
            if (x[k] == z) {
                k++;
            }
            else {
                return "string";
            }
        }
    }
    return "int";
}
int main() {
    string inp;
    cin >> inp;
    cout << datatype(inp);
}
Whatever i enter, it always returns "string". I have seen the other questions posted here but please tell me what is wrong in my approach.
 
     
     
    