DIGJUMP-code passing all test cases but giving WA

#include<bits/stdc++.h>
using namespace std;
#define showoff ios_base::sync_with_stdio(false)
#define ll long long int
#define sd(x) scanf("%d", &x)
#define pf(x) printf("%d",&x)
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef pair< int,int > ii;
#define sz(a) int((a).size())
#define pb push_back
#define all© ©.begin(),©.end()
#define rall© c.rbegin(), c.rend()
#define tr(c,i) for(typeof(©.begin() i = ©.begin(); i != ©.end(); i++)
#define present(c,x) (©.find(x) != ©.end())
#define cpresent(c,x) (find(all©,x) != ©.end())
#define maxn 100001
vectoradj[maxn];
//int dist[maxn];
bool visit[maxn];
string s;int n;
void make_graph(string s,int n){
for(int i=0;i<n;i++){
if(i==0)
adj[i].pb(i+1);
else if(i==n-1)
adj[i].pb(i-1);
else
{
adj[i].pb(i-1);
adj[i].pb(i+1);
}
for(int j=0;j<s.length();j++){
if(s[j]==s[i] && j!=i-1 && j!=i+1 && i!=j)
adj[i].pb(j);
}

}}
int bfs(){
int moves=0;
priority_queueq;
q.push(0);
while(!q.empty()){
int node = q.top();
if(node==n-1)
break;
if(visit[node])
continue;
else{
visit[node]=true;
moves++;
}
for(auto it =adj[node].begin();it!=adj[node].end();it++){
q.push(*it);
}
}
return moves;
}

int main(){
for(int i=0;i<maxn;i++)
visit[i]=false;
cin>>s;
n=s.length();Preformatted text
make_graph(s,n);
int moves=bfs();
cout<<moves;
}

No Question link, niether code is formatted, just
`` in start and end or idone it and paste the link