Advertisement
Anik_Akash

11048 - Automatic Correction of Misspellings

Mar 3rd, 2021
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.12 KB | None | 0 0
  1. ///Stone pile
  2. #include<bits/stdc++.h>
  3. using namespace    std;
  4.  
  5. #define flush        cin.ignore(numeric_limits<streamsize>::max(),'\n')
  6. #define fasterio     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
  7. #define NL           printf("\n")
  8. #define pi           acos(-1.0) //3.1415926535897932384626
  9. #define mx           7500000
  10. #define dpoint(x)    fixed<<setprecision(x)
  11. #define mod          1000000007
  12. #define pb           push_back
  13. #define scn(x)       scanf("%d",&x)
  14. #define scnd(x)      scanf("%lf",&x)
  15. #define sc(x)        scanf("%s",x)
  16. #define debug(x)     cout<<x<<endl;
  17.  
  18. typedef long long int       ll;
  19. typedef double              dl;
  20. typedef unsigned long long  ul;
  21.  
  22. // --------------------------Pre made Functions & Proto Type--------------------------//
  23. template <class T> T gcd(T a, T b){if(a == 0) return b;return gcd ( b%a, a );}
  24. template <class T> T lcm(T a, T b){return ( ( a/gcd ( a, b ) )*b );}
  25. template <class T> T digitsum(T n){T sum=0;while(n!=0){sum+=n%10;n/=10;}return sum;}
  26.  
  27.  
  28. int main()
  29. {
  30. //   #ifndef ONLINE_JUDGE
  31. //       freopen("input.txt","r",stdin);
  32. //       freopen("out.txt","w",stdout);
  33. //   #endif
  34.     int test;
  35.     scanf("%d",&test);
  36.     char word[test+5][27];
  37.     for(int i=0; i<n; i++) scanf("%s",word[i]);
  38.     int q;
  39.     scanf("%d",&q);
  40.     for(int i=0; i<q; i++)
  41.     {
  42.        int c_checker=0, m_checker=0, cnt=0;
  43.        char valu[27];
  44.        scanf("%s",valu);
  45.        for(int j=0; j<n; j++)
  46.        {
  47.            if(strcmp(word[j],valu)==0)
  48.            {
  49.                ///
  50.                printf("%s is correct\n",valu);
  51.                c_checker=1;
  52.                break;
  53.            }
  54.        }
  55.        if(c_checker==0)
  56.        {
  57.             for(int j=0; j<n; j++)
  58.             {
  59.                 int valu_ln = strlen(valu);
  60.                 int word_ln = strlen(word[j]);
  61.  
  62.                 if(valu_ln - word_ln == 1) ///for missing one letter
  63.                 {
  64.                     for(int k=0; k<valu_ln; k++)
  65.                     {
  66.                         if(word[j][k])
  67.                     }
  68.                 }
  69.             }
  70.        }
  71.     }
  72.  
  73.  
  74.     return 0;
  75. }
  76.  
  77.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement