Loading Similar Posts
Q1 .
#include<bits/stdc++.h>
using namespace std;
int solve(vector<string>&v){
int ans=0;
int n=v.size();
for(int i=0;i<n;i++){
string x=v[i];
if(x=="../"){
ans=ans-1;
}
else if(x=="./"){
ans=ans+0;
}
else if(x[0]!='.'){
ans=ans+1;
}
}
return ans;
}
int main(){
int n;
cin >> n;
vector<string>v(n);
for(int i=0;i<n;i++){
cin >> v[i];
}
int ans=solve(v);
cout << ans << endl;
}