Need help with determining time complexity

This is the function I used for solving “removing duplicate elements from a string”. I am unable to figure out its time complexity. What is its time complexity?

inline string removedup(string s){
    int n = s.length();
    if(n == 1)
        return s;
    int i = 1;
    string str;
    if(s[0] != s[1])
    while(i < n){
        if(s[i] == s[i - 1]);
        else if(i < n-1 and s[i] == s[i+1]);
    if(str.length() == 0)
        return str;
    if(str.length() != n)
        return removedup(str);
    return str;

Btw why are you seeing this condition. This has already come in first if.

else if(i < n-1 and s[i] == s[i+1]);

Acc to me, your time comp should be O(n)

I am not doing anything there just passing it out. BTW i got the answer the time complexity will be O(n^2). thanks.