Advertisement
Saleh127

atc 043D

Sep 3rd, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int t; cin>>t; while(t--)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);
  9. cout.tie(0);
  10.  
  11. ll c,d,e,f,i,j,k,l;
  12. string a;
  13. cin>>a;
  14. if(a.size()==2)
  15. {
  16. if(a[0]==a[1])
  17. {
  18. cout<<"1 2"<<endl;
  19. }
  20. else cout<<"-1 -1"<<endl;
  21. }
  22. else
  23. {
  24. for(i=0; i<a.size()-2; i++)
  25. {
  26. if(a[i]==a[i+1])
  27. {
  28. cout<<i+1<<" "<<i+2<<endl;
  29. return 0;
  30. }
  31. if(a[i]==a[i+2])
  32. {
  33. cout<<i+1<<" "<<i+3<<endl;
  34. return 0;
  35. }
  36. if(a[i+1]==a[i+2])
  37. {
  38. cout<<i+2<<" "<<i+3<<endl;
  39. return 0;
  40. }
  41. }
  42. cout<<"-1 -1"<<endl;
  43.  
  44. }
  45.  
  46. return 0;
  47. }
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement