文字列処理

AOJ - Problem 0127 : Pocket Pager Input

問題文 問題文の通りに文字列を変換します。入力した文字列の長さが奇数か変換表にないときは"NA"を出力します。 #include <iostream> #include <string> using namespace std; char table[6][5] = { {'a','b','c','d','e'}, {'f','g','h','i','j'}, {'k','l','m','n','o'}, {'</string></iostream>…

AOJ - Problem 0020 : Capitalize

問題文 アルファベットの小文字を大文字に変換して出力するプログラムです。 文字列関連の問題はASCIIコードの知識があると 楽になることがあるので覚えておくといいかもしれません。 #include <iostream> #include <string> using namespace std; int main(){ string s; while</string></iostream>…

AOJ - Problem 0017 : Caesar Cipher

問題文 シーザー暗号に関する問題です。何故かWAをたくさん出してしまいました。 きっとWAを出した人が多い気がします。1行の文字列を何文字かずらしそのなかに"the","this","that"が含まれていたら 出力するようにします。一行ごとに読み取り、その文字列…

AOJ - Problem 0006 : Reverse Sequence

問題文 文字列を逆にして出力する問題です。 なお最後に改行を出力しないとWAになるので注意しましょう! #include <iostream> #include <string> #include <algorithm> using namespace std; int main(){ string s; while ( cin >> s ) { reverse( s.begin() , s.end() ); cout << s << e</algorithm></string></iostream>…