Language: C++

#include <iostream>
#include <algorithm>

using namespace std;
long long n,i,j,sol,prev=0, mod=1000000007,poz,hor,ver;
char s1[54], s2[54];

int main()
{
    cin>>n;
    cin>>s1>>s2;
    poz=0; prev=-1; sol=3;
    while(poz<n)
    {
        ver=0; hor=0;
        if(poz<n-1 && s1[poz]==s1[poz+1]) hor=1, ver=0, poz+=2;
        else ver=1, hor=0, poz++;
        if(hor)
        {
            if(prev==-1) sol*=2;
            else if(prev==0) sol=(3*sol)%mod;
            else sol=(2*sol)%mod;
            prev=0;
        }
        if(ver)
        {
            if(prev==-1) sol*=1;
            else if(prev==0) sol=(1*sol)%mod;
            else sol=(2*sol)%mod;
            prev=1;
        }
    }
    cout<<sol<<'\n';
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:12:12: error: reference to 'prev' is ambiguous
   12 |     poz=0; prev=-1; sol=3;
      |            ^~~~
In file included from /usr/include/c++/14/string:47,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:5:21: note:                 'long long int prev'
    5 | long long n,i,j,sol,prev=0, mod=1000000007,poz,hor,ver;
      |                     ^~~~
a.cc:20:16: error: reference to 'prev' is ambiguous
   20 |             if(prev==-1) sol*=2;
      |                ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:5:21: note:                 'long long int prev'
    5 | long long n,i,j,sol,prev=0, mod=1000000007,poz,hor,ver;
      |                     ^~~~
a.cc:21:21: error: reference to 'prev' is ambiguous
   21 |             else if(prev==0) sol=(3*sol)%mod;
      |                     ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:5:21: note:                 'long long int prev'
    5 | long long n,i,j,sol,prev=0, mod=1000000007,poz,hor,ver;
      |                     ^~~~
a.cc:23:13: error: reference to 'prev' is ambiguous
   23 |             prev=0;
      |             ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:5:21: note:                 'long long int prev'
    5 | long long n,i,j,sol,prev=0, mod=1000000007,poz,hor,ver;
      |                     ^~~~
a.cc:27:16: error: reference to 'prev' is ambiguous
   27 |             if(prev==-1) sol*=1;
      |                ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:5:21: note:                 'long long int prev'
    5 | long long n,i,j,sol,prev=0, mod=1000000007,poz,hor,ver;
      |                     ^~~~
a.cc:28:21: error: reference to 'prev' is ambiguous
   28 |             else if(prev==0) sol=(1*sol)%mod;
      |                     ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:5:21: note:                 'long long int prev'
    5 | long long n,i,j,sol,prev=0, mod=1000000007,poz,hor,ver;
      |                     ^~~~
a.cc:30:13: error: reference to 'prev' is ambiguous
   30 |             prev=1;
      |             ^~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:244:5: note: candidates are: 'template<class _BidirectionalIterator> constexpr _BidirectionalIterator std::prev(_BidirectionalIterator, typename iterator_traits<_Iter>::difference_type)'
  244 |     prev(_BidirectionalIterator __x, typename
      |     ^~~~
a.cc:5:21: note:                 'long long int prev'
    5 | long long n,i,j,sol,prev=0, mod=1000000007,poz,hor,ver;
      |                     ^~~~