fork download
  1. #include<iostream>
  2. #include<stdio.h>
  3. #include<string.h>
  4. using namespace std;
  5. char store[26][6]={"ka","zu","mi","te","ku","lu","ji","ri","ki","zu","me","ta","rin","to","mo","no","ke","shi","ari","chi","do","ru","mei","na","fu","zi"};
  6. int main()
  7. {
  8.  
  9. int test=10;
  10. while(test--)
  11. {
  12. char ch[50];
  13. gets(ch);
  14. int length=strlen(ch);
  15. for(int i=0;i<=length;i++)
  16. {
  17. if(ch[i]=='~'||ch[i]=='\0')
  18. {
  19. int j=i-1;
  20. for(;(j-1)!=-1&&(ch[j-1]!='\0');j--);
  21. ch[i]='\0';
  22. for(int k=0;k<26;k++)
  23. {
  24. char *c=ch;
  25. c=c+j;
  26. if(strcmp(c,store[k])==0 )
  27. {cout<<(char)(97+k);break;}
  28.  
  29. }
  30. }
  31. }
  32. cout<<endl;
  33. }
  34. return 0;
  35. }
  36.  
  37.  
Success #stdin #stdout 0s 2732KB
stdin
chi~ri~ku
ka~to~ari~mei~ku~shi
chi~mo
chi~ri~ki~ari
no~shi~mo~zu~ta~ku~rin
ki~ari
ari~ki~na
te~ki~ru~ki~te~ku~te
zu~fu
ri~ka~ta~lu
stdout
the
answer
to
this
problem
is
six
divided
by
half